You cannot use this to update an existing attribute's value.
Instead, get a DOM version of the SimpleXMLElement and use setAttribute, as per:
$XML = '<element a="aa">Text</element>';
$snode = new simple_xml_element($XML);
$dnode = dom_import_simplexml($snode);
$dnode->setAttribute('a', 'bb');
Resulting XML for the node is:
<element a="bb">Text</element>