Punishing your cat for scratching is not a good idea for several reasons. He doesn’t understand why he is being punished and may associate bad things with you. You might hurt him.
And it’s not very effective either, as most cats will simply learn to scratch when you’re not around rather than not at all.