I don't have POCD, but I do have some Pure-O obsessions along with standard OCD. So I can definitely relate to having intrusive thoughts and feeling completely controlled by them. It's a very scary thing. The good thing is that you realize that what you're feeling is a fear, not attraction. So, realistically, this is totally the product of an anxiety disorder. It's not really you or your desires propelling you forward. You don't have to feel like you're a bad person for having these thoughts. Most likely, you'll never carry out anxiety-provoking these thoughts, they're just that--fears. So, I think that's what you should start by reminding yourself.
Children experiment and as we're growing up, we do what seem like some pretty strange things later on as we're aging. So, whatever this 'terrible' thing you did, it probably was just a method of childhood exploration or mimicking adults. Masturbating in a public bathroom is also not a crime and something that a lot of people would find acceptable even. The fact that you have guilt and shame over these things show that your moral compass is working (even if it's in overdrive). To put it lightly, you don't sound like a sadistic pervert to me. You're clearly someone suffering from intrusive obsessions that are driving you to paranoia and guilt about your personality which are subsequently controlling your life.
Are you in school? If you are, there is almost always access to some type of mental health counselling. It may be terrifying, but in the end, it's always worth it. Revealing to someone (usually it's safer to reveal it to a professional when your obsessions deal with these kinds of topics) can help tremendously and is a good step to be on your way to maintain your disorder.
I'm not sure where you live or what gender you are, but there may be other free or cheap psychological counselling within your community. There are probably even accessible support groups. The problem is that you have to commit to wanting to deal with this and to do that you have to admit, out loud, that it's happening.
I've been in therapy for OCD, and really the goal you're going to try to reach is not to ultimately ever have these type of thoughts because, things happen, stuff goes through are mind that we can't control. The goal is to not be driven to obsess over the answer. Am I really a bad person? Would I really do that? You need to work on self-affirmation and rationalize every irrational anxiety-driven thought and impulse. I know this is extremely difficult, but that's the bottom line. Obviously, psychiatric/psychological help would be the most beneficial option.
If you really don't have access to any help within your community, you might want to Google ERP and CBT. These are the two therapeutic methods mainly used when treating any kind of OCD.