Thanks for your question and concern. First of all if you feel so much of pain, then it would be good to have it discussed with a doctor or to a nurse. You can get advice about this from a local doctor (GP) or even from the nearest family planning clinic.
The thing that happened to you is that it is so much pleasurable for you to have masturbation; most people will become addicted to the pleasure giving things. So you have become addicted to masturbation as it gives so much pleasure to you than anything else. Masturbation is actually a completely natural process. It is also a normal process too. But when it comes to interfere with the rest of the life and if it is causing you some kind of physical harm, then it would be good to speak to someone else about all this.
Most people find it good to undergo a counseling to solve all these problems. The counselor will first listen to all the things you tell him and then he will give you advice on all your problems. It would be quite easy for most people to have their problems discussed with a counselor as you do not have to worry about the other persons feelings, if you are speaking out all your problems to your friend or to your family member, then you should have to take into consideration bout the other persons feelings too. You cannot feel free to talk to a relative as there are things to hide, if you talk all the things, then it would cause some family problems to raise. So you cannot be yourself while telling something to your relative or so. While talking to a counselor you can talk to him confidential that is he would not tell the things you tell to him to anyone else. You can be yourself while discussing your problems with the counselor and also there is an advantage that he would not judge your feelings or any of the actions you have taken. You will be free and discuss any problem you are facing in your life. So take a good decision and have your problem treated soon enough. It is important for you to have a good counseling and also should have your wounds on the penis treated soon. Delaying treatment would cause the problems to get worse. Treating the infections at their starting stages would be good. Sexual health is to be taken care of. It is important so do not delay the time. Moreover, this is not going to cause any erectile dysfunction. Take a good decision as soon as possible. Take care.