open the output file
while (there are more input files)
{
open the next input file
while (there is more data in the input file)
{
read the next line from the input file
write the line to the output file
}
close the input file
}
close the output file
No need for seeks or tests for names etc.