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

Er, it does. Sorry, my eyes are broken *__*