You did not listen to God, so he did that. He was angry with the Amalek mob, so he told you to finish all of them up, and their animals too. He told you what to do, but you didn’t do it.