But he was appointed by God and God although punishing him also forgave him and backed him up and that is the point.
You forgot to mention that God killed 70,000 innocent persons for David's sin of taking a census. And as you mentioned God killed an innocent baby to punish David. Any other Jew would have had to bear the penalty for their sins personally and been stoned to death. Not David though. And that is the example that today's pedophiles in the JW's can fall back on. Punish the innocent for the crimes of the guilty.