Why was each monkey wearing a cap on their head?

Because

They were imitating the seller
When he looked up the sky, he was very surprised to see monkeys sitting on the branches of a tree, each wearing a cap on his head. They had evidently done it to imitate him.
  Dito : I heard your brother was robbed in front of a bank after he had with drawn a lot of money.