David is not to blame for the Amalekites that managed to escape. He did his best to kill them all. We are told about them in order to make it clear that the Amalekites where much more numerous than David and his men. It was a victory against all the odds.1 Coupled with Saul’s earlier defeat of the Amalekites (cf. 1 Samuel 15:1–35), it appears that their numbers and power had now been severely diminished. They will not be mentioned again until the time of Hezekiah (1 Chronicles 4:43).2
17 And David struck them down from twilight until the evening of the next day, and not a man of them escaped, except four hundred young men, who mounted camels and fled.