not because of my transgression or my sin
The writer has transgressed and sinned, but not against those who "prepare to run" at him.
they wait in ambush to take my life
David's enemies are in hiding and are waiting quietly for the time when they can attack him.