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

ok, renaming