Well, that's what you do here, you handle datafield
as a single node, so the first one is used (why should it be the last one?):
$xml->record->datafield->addChild('subfield', $value);
But you already have your desired parent in $addData
, just use it:
$addData->addChild('subfield', $value);