I've read that in the bible too that no good deed goes unpunished.
But what I believe it means is that when you do a good deed to try and help somebody it's not god who is the one that is punishing you but instead the person you helped or tried to help is punishing you.
I could be misreading that though and it could be god that punishes you.
However I have noticed that when I do try and do good things to help people it always seems to come back and bite me in the butt and something bad seems to happen to me.
It's usually the people that I help that eventually turn on me.
Still it's not gonna stop me from doing good things when I feel I need too.