I am not 100% sure I understood your specification, but here is what I would do:
#!/usr/bin/perl
use warnings;
use strict;
use XML::LibXML;
my $xml = 'XML::LibXML'->load_xml(IO => *DATA{IO});
my @ids = qw(S14 S15);
my @strings = map $xml->findnodes('//TextLine/String[@ID="' . $_ . '"]'), @ids;
my $new = join q(), map $_->findvalue('@SUBS_CONTENT'), @strings;
$_->setAttribute('SUBS_CONTENT', $new) for @strings;
print $xml->toString;
__DATA__
<r>
<TextLine>
<String ID="S14" CONTENT="Gun" SUBS_TYPE="HypPart1" SUBS_CONTENT="Gun"/>
</TextLine>
<TextLine>
<String ID="S15" CONTENT="nersen" SUBS_TYPE="HypPart1" SUBS_CONTENT="nersen"/>
</TextLine>
</r>
I retrieve the partial strings from the XML, join them into $new, then set $new as the new value of the attributes.