Don't know about your first issue, but your second one is about closing elements correctly, as the original error stated. You need this kind of structure:
<append>
<lootgroup>
<item /> <-- this is a self-closing element.
</lootgroup> <-- this closes the lootgroup element, which you're missing
</append>