@Grace3 .......try not to be too hard on yourself. Treat yourself with kindness.
Yes, you are only hurting yourself. You say you are punishing yourself.
Now, I'm wondering........for what are you punishing yourself? I am
not asking you to answer this, as it is clearly none of my business. But it might be a good question to ask yourself. Something maybe just to sit with, not even demanding an answer from yourself, but just asking the question, and see what comes to you.
Sometimes just sitting with a question will bring some interesting insights.
If you feel guilty or bad about things you do or have done, try kindness to yourself. Do something that you know is good for you. throw out all the chocolate and other harmful things in your house. Go out and buy your favorite kind of fruit, no matter how expensive it is, and eat that instead.
Be firm with yourself, but be gentle at the same time.
When I am training a dog, I do not let the dog just get away with a bad behavior. But I never, ever punish a dog either. I don't hit or yell or scold. I just gently make it easy for the dog to do what I want, and hard for the dog to do what I don't want. I do everything I can to set the dog up for success, never for failure.
This means, I never put the dog into a position in which the dog will feel he or she needs to do, or is overly tempted to do the thing I don't want. Instead, I create situations in which it's easy for the dog to choose the right thing to do, and then I praise and reward the dog. I always focus on the dog's success, and let go immediately of the times they fail to do what I want.
People and dogs are really not all that different. People need to be set up for success, too. that means if they need to change a behavior they need to remove the temptation to do the behavior they want to change, and they need to make it easy for themselves to do the thing they want to choose instead. They need to reward themselves (not by then doing the unwanted behavior! But with something else) when they succeed in choosing the right thing. They need to focus on their successes, never their failures, because there will always be both. Focusing on and striving for the successes leads to more successes.