Thanks for your query.Based on the facts that you have posted it appears that you have undergone surgery for Testicular Torsion
2 months back and now getting pain in testicle and abdomen.
This could be due to grade one varicocele
. However this can be confirmed only on clinical examination and Colour Doppler study of scrotum.
The possibility of pain in testicle is unlikely to be due to masturbation
Please consult qualified Urologist
for clinical assessment and further treatment.