what is the word to express the action of showing pity/appriciation on a younger person like a student or son by rubbing the head
We don't have a single word for it and it doesn't just apply to students or sons. It's mainly done to children but I've seen adults do it to each other sarcastically.
He patted her on the head sympathetically.
She patted her son on the head, saying "Well done, you were fantastic!"