in reply to
It helps if you give us non-biologists context as to what data the files contain. If you had said they were FASTA format files then you might have got a "fasta" response geddit? :-)
You're essentially taking an entry from each file at a time, but you could do this by reading each file into an array, and unshifting an entry off each array as d1 and d2 and then doing:
A Monk aims to give answers to those who have none, and to learn from those who know more.