I’m so glad you wrote. You’ve been diagnosed with OCD. You managed to stop thinking about hurting kids but now your brain has latched on to another intrusive thought: having sex with them. The reason you can’t stop the thoughts on your own is that orgasm is a very, very powerful reinforcer (reward). When a person is rewarded for doing something, they want to do it again. Every time you masturbate to orgasm while watching children, you are connecting kids with the pleasurable feelings.
That doesn’t necessarily mean you are a pedophile In fact, I doubt you are. I do think your OCD is at the root of it and that you need more treatment to help you break the reinforcement cycle you are in.
To do that, you need to go back to the psychiatrist and have a completely honest talk about the problem. A doctor can only help you fix what you tell him about. If the doctor specializes only in medications, you may be referred to a counselor to work on stopping the thoughts.
Do take your letter and my response with you to the first session as a way to help you share your concerns with the counselor (or psychiatrist).
I wish you well.