Washing hands is a form of purification. David is saying he will keep his hands clean of evil so that when he does wash them they are clean.