Welcome to HCM
We understand your problem.
I went through your details. I suggest you not to worry much. The problem of erectile dysfunction
could mostly due to psychological causes than organic causes. You talked about masturbation
habit. Masturbation is no sin and is pretty normal and natural. Even animals masturbate. Ill concepts about masturbation might have lead towards negative thinking about masturbation and resultant erectile dysfunction. Finding semen in the urine is common. In your case it is because you are not masturbating or having sex.
You need to have sexological counseling and sex therapy
. Do post a direct query in this website and I shall prescribe some techniques to overcome erectile dysfunction.
Hope this answersw your query. Available for further clarifications.