Then answer to your question is as follows:
You must repent sincerely to Allah for whatever you did in the past. And also you have to consult a knowledgeable and experienced doctor or hakeem for the treatment of the same without any delay. May Allah help you to get rid of this kind of acts.
And Allah knows best
Darul Uloom Waqf Deoband
This answer was collected from the official website of Darul Uloom Deoband Waqf. The institution is based in India and the answers are provided in accordance to the Hanafi Fiqh.