in reply to printing contents of small files into one larger one

Depending on the actual size of your files, you could (this is pseudocode, sorry):

1. loop through each file (open file, slurp into an array, close file).
2. Add the array data to a 2-D array (each 'row' of the array would contain the data from each file).
3. Do a transpose on the 2-D array to get the data in the format you want.

This method would require 2 loops: The first to read the data from the files and add to the array. The second to transpose (which would be a simple 2-D nested loop).
Code is untested unless explicitly stated