Hello,
Welcome to ehealthforum and thanks for writing us
The symptoms described as pain during and after intercourse can be indicative of vaginal infection,cervicitis,pelvic infection or sexually transmitted infection.
A pelvic examination and Pap smear test would help in giving a better idea whether there is presence of any infection or not.Since it has been present for quite long I would advice you to get a evaluation done by a Gynaecologist and also required investigations.
It is not related with the masturbation.
Till then follow simple measures as:
1)Wear cotton clothes and underwear and avoid wearing any coarse or synthetic material. When doing exercise wear athletic tights or cycling shorts.
2)Wear clean and dry clothes and use a mild detergent to wash them.
3)Wash the area with tea tree oil mixed in water.
Hopoe it helps!