Need help figuring out code

I have been working on an Igor project file for about a week now. I need it to first list .edf and .txt files then stitch them together to create GB files. There was an original program but this program had a bug where it would not match the files before it stitched them. I will include both my version and the original. Any advice would help because the program is compiling but it still is not handling the data correctly. This is my first experience with IGOR so any tips are also appreciated. Thank you very much for your time and assistance.

DoStitch.ipf (7.74 KB) Procedure_0.ipf (7.87 KB)
It's hard to tell from the few information you give what the problem is. I suggest to use the debugger, e.g. execute:

Displayhelptopic "The Debugger"

Try to figure out where the code fails. I had a quick look: The function "SelectDataPath(ba)" requires a global string variable "InputPath" to be defined before it is being called. InputPath is not generated when you call the panel. I don't know where it is supposed to come from. I did not look through the rest of the code.