Try this. I took your two values from the top and bottom and created arrays for each using autoindexing terminals. After I created both arrays I built them into a 2d array. Using the previous example I turned them into a tab delimited string and then simply by using the write chars to file vi you will have your output files. I think this is what you are asking for. I moved the file I/O outside the loop so you are not wasting cpu by opening and closing the file every time the loop iterates. Hope this helps.
BJD1613
Lead Test Tools Development Engineer
Philips Respironics
Certified LV Architect / Instructor