Remove the index from the for loop to the remove child. You need to always remove the child at Index 0.
3 Examples for clearing children.
2
3