First, let’s address the idea that you are having bad thoughts.
There are no such things as bad thoughts, there are just thoughts. Just because you think a thought is bad does not mean that it is. Further, your belief that you are having bad thoughts is likely to actually increase your OCD behaviors.
Second, how can you be punished for your thoughts? The only way that could happen is if you believed that a higher power was going to punish you. No other person can hear your thoughts, so no one can punish you for them. And if you do believe that a higher power will punish you for those bad thoughts, then why is that higher power not punishing all sorts of other people who have gotten away with cheating and lying and harming others?
Here is another way to look at this: Do you believe that this higher power is all-powerful (probably, if you believe they can read your mind)? If so, then don’t you think that this higher power knows that you have OCD and that it is the OCD that is leading you to have the thoughts that you are having? If that is the case, then why would that higher power punish you for what your OCD is doing?
In terms of stopping the thoughts, thoughts will always randomly pop into your head. This is human nature. The trick to stopping them is to not try to stop them. You need to recognize that because these are just thoughts, they will come and go throughout the day. If you can let them go, then you will not need to do any compulsive behaviors to try to get rid of them. And if you can refrain from compulsions, you eliminate the majority of your OCD.
If you can continue to resist performing compulsions, you may realize that the themes or fears in the obsessions do not come true, even if you don’t engage in the compulsions. Thus, you will become less afraid of the obsessions and will see a decrease in them as well. Of course this is a simplified version of what would happen in therapy, but the basic idea is there.
Fighting thoughts just makes them stronger and last longer, whereas accepting them and testing whether the feared results do happen when you do not perform the compulsions will most likely bring a great deal of relief.