Fixes #5065: create a generic method to add line in xml section

This should really be .xml