Nested while read loops with fd
Your text files do not end with newlines:
$ printf 'Foo\nFoo' > sample-1.txt$ printf 'Bar\nBar' > sample-2.txt$ bash tmp.shFooBar$ printf '\n' >> sample-1.txt$ printf '\n' >> sample-2.txt$ bash tmp.shFooBarBarFooBarBar
read
has a non-zero exit status if it reaches the end of the file without seeing a newline character. There's a hack to work around that, but it's better to ensure that your text files correctly end with a newline character.
# While either read is successful or line is set anywaywhile read line <&3 || [[ $line ]]; do