def write_list_to_file(list, file_to_write):
    """ Iterates over the entries in a list and writes them to a file,
    one list entry corresponds to one line in the file

    :param list: the list to be written to a file
    :param file_to_write: the file to write to
    :return: 0 on success
    """
    with open(file_to_write, 'w') as f:
        for line in list:
            f.write(line.rstrip('\n')+"\n")
    return 0