awk is an interesting choice for learning programming. The more I think about it, the more I like it.
nr = 0
fname = "sorted_"match".tempo"
while ((getline < fname ) > 0)
line[nr] = $0
Use code tags as above to make your posts more readable.
I added a line to set nr to 0 before the loop. Otherwise it will keep incrementing from the previous file.
Rather than compute the filename each time, lets use a variable and do it once.
If you don't print the line inside the loop, then it will only print the last line.
If you aren't using the array "line" later, then you can just print $0 and get rid of line.