Editing xml data

Im trying to add elements to the xml file and it adds them when i trace it but when i check the actual file its not there.

node = _root.xmlClass.createTextNode(_root.name);
_root.xmlClass.firstChild.firstChild.appendChild( node);
trace(_root.xmlClass);

when i check the file it dosent appear but it does when i trace, how do i get it to change xml file