ANSWER:
It’s not permissible to punish yourself like this.
Sincere repentance with deep remorse is sufficient.
You should do a lot of voluntary acts of worship, especially night prayers besides completing all the obligatory acts of worship because good deeds erase bad deeds.