Assuming the files are text you can "merge" them just by using the 'cat' command:
cat file1 file2 >> outfile
Depending on the format of the input lines, you might get by with sorting them just by using the 'sort' command. It might be neccessary to use 'cut' and 'paste' commands to restructure the input so that it will sort in the desired manner. Or, you might need something more, a script perhaps. Hope this gets you started.