I think your question is based on an inaccurate assumption.
You are assuming that these Amalekite children are being killed-punished- for the sins of their ancestors.
That's not 100% correct.
In Judaism, suffering can come for multiple reasons. These reasons can be categorized loosely into two categories: Past and Future.
For a great introduction and ...