In Quran Allah says there is no compulsion in deen (2:256) then why is it that Kafir get punishment.

According to the Quran and Hadith there is no punishment for kafir or murtadd or anyone else. Freedom is the unconditional right of every human being. Some Muslims speak about punishment, but it has nothing to do with the Quran and Hadith.