I don't really know anything about the DOMDocument class, but based on what you've posted here it is the save() method that is adding the xml version declaration, in which case the solution is simple: just get the data you are echoing, and write it to the file yourself. It looks like the saveXML($root); call returns a string, which is what you are outputting (printing).
print $dom->saveXML($root);
So just catch that data in a variable:
$myxml = $dom->saveXML($root);
...and write it to a file:
file_put_contents("ServerSettings.xml",$myxml);
Don't bother calling
$dom->save("ServerSettings.xml");
Unless I am missing something here, it looks like that should solve your problem.