Maybe your .txt files are actually soft links? Maybe you're not correctly specifying the path when testing with -f? Or maybe your problem is on line 42, which specifies the flying pink unicorns?
Seriously, read through your question again, how are we supposed to know what you're doing wrong if you're not showing it? We can't help you with code we don't see. Show us the code in question (only the code for this specific question, no need to post your entire script), and possibly show the output of ls -al of the directory you're examining, and you'll get a more helpful answer.