Richard is correct.
Create a "root" node to hold the nodes you are appending.
Then, each time, remove everything from the root node.
Or, remove the root node itself and append it back in, and then append each child to that root.
Check this out:
HTML DOM Element remove Method[
^]