Yes, you did do something wrong. Staring at an underage or handicapped person’s crotch is against the law and rightfully so. But — and this is an important but — you weren’t knowingly doing it for your own titillation. You have OCD.
I’m not a lawyer, so I can’t respond to how the diagnosis factors in legally. But as a psychologist, I can say that I don’t see you as a bad person. I see you as a person with a long-term mental illness that isn’t currently being treated. It isn’t helpful to judge yourself harshly for what you did. It is more useful to understand the incident as a signal to yourself that you still need treatment.
Sadly, you’ve had a hard lesson in the consequences of not working with a therapist. Get back into treatment with a prescriber and a therapist. There are alternatives if you don’t have the ability to pay. See this article for a list of options.
I wish you well.