I think revenge turned into a crime.
What did you do to get your revenge?
I was beating him and ended up stealing so it became a robbery.
Revenge is never a good idea and it can lead to things like prison even if you hadn't committed robbery. You will have to pay for your crime.
It doesn't feel right to be punished for my actions.
I think that that is exactly what is going to happen though, since you committed the crime. I think that you should not cause harm to others, so that you do not have to worry about it in the future.