append a line of text to a file

def append_to_file(file_name, line_data):
    """append a line of text to a file"""
    with open(file_name, mode='a', encoding='utf-8') as f1:
        f1.write(line_data)
        f1.write("\n")