This is my starting xml :
&
With DOMDocument it's as easy as this:
$child = new DOMElement('children');
$parent->appendChild($child);
Whereas $parent is the DOMElement parent which (after you have updated your question) to aquire is part of your problem:
// append to the first element
$parent = $dom->getElementsByTagName('child')->item(0);
$child = new DOMElement('children');
$parent->appendChild($child);