It says that Infernape learns punishment at lv29, doesn't that mean it's impossible?
It is possible for Infernape to learn Punishment. If you take your Infernape to the person who can make your pokemon remember a move, and give him a Heart Scale, you can get it to learn Punishment.
you can teach a move that a pokemon learns at a level before it evolves using a by the move reminder in exchange for a heart scale
You can teach it in the way people have already said (if you need a heart scale check out victory road), but dont bother its a rubish move on infernape unless you are against psychic pokemon that infernape is weak to.
Hope this helps you