Try changing line 5 to
document.getElementsByTagName("a:Value")[0].childNodes[0].data = '124241';
Edit
Here is the code I wrote at "runkit.com" to demonstrate how I solve the problem as mentioned in the comment.
// some make-up xml
var xml = `
<root>
<a:table xmlns:a="http://www.w3schools.com/furniture">
<a:name>African Coffee Table</a:name>
<a:width>80</a:width>
<a:length>120</a:length>
<a:Value>old value</a:Value>
</a:table>
</root>`;
var DOMParser = require( 'xmldom' ).DOMParser;
var parser = new DOMParser();
var document = parser.parseFromString( xml, 'text/xml' );
// this won't work, but no error
document.getElementsByTagName( "a:Value" ).nodeValue = 12345;
// check: you will get "undefined" on the console
console.log( document.getElementsByTagName("a:Value").nodeValue);
// check: you will get "old value" on the console
console.log( document.getElementsByTagName("a:Value")[0].childNodes[0].data );
// here is another try
document.getElementsByTagName("a:Value")[0].childNodes[0].data = '12345';
// next, you will get "12345" on the console as expected
console.log( document.getElementsByTagName("a:Value")[0].childNodes[0].data );
var XMLSerializer = require( 'xmldom' ).XMLSerializer;
var serializer = new XMLSerializer();
var xmlstring = serializer.serializeToString( document );
console.log( "xmlstring: \n" + xmlstring );
The relevant output from console.log():
undefined
old value
12345
xmlstring:
<root>
<a:table xmlns:a="http://www.w3schools.com/furniture">
<a:name>African Coffee Table</a:name>
<a:width>80</a:width>
<a:length>120</a:length>
<a:Value>12345</a:Value>
</a:table>
</root>