"""Concatenates files into the file given as the last argument."""

import sys

concatenated = ''

if len(sys.argv) > 2:
    for filename in sys.argv[1:-1]:
        with open(filename, 'r') as file:
            concatenated += file.read()

    with open(sys.argv[-1], 'a') as out:
        out.write(concatenated)
