def write_lines(new_lines, lines, edit_index):
    """
    Inserts new lines where specified

    :param new_lines:   the new lines to be added
    :param lines:       holds all the current lines of output html file
    :param edit_index:  the index to insert new lines
    :return:            new contents of output html file
    """

    lines[edit_index:edit_index] = new_lines
    edit_index += len(new_lines)

    return lines, edit_index