Your Perl program is broken. The first 49 "if" statements do not have their closing braces. A part of your script is shown below with the problem:
...
...
if ( $. == 1 ) { <== this opening brace does not have a corresponding closing brace
s/$/ Index/;
if ( $. == 2 ) { <== this opening brace does not have a corresponding closing brace
s/$/ Chromosome Position/;
...
...
As a result the Perl script, when run, will fail and abort with a compile time error similar to the following (I've put the 3 dots below (...), but you'll see some information instead of the dots):
Missing right curly or square bracket at ...
syntax error at ...
Execution of ... aborted due to compilation errors.
(1) The reason you are seeing a file in your L:\NGS location is because that is done by your shell. When you put a redirection operator "> some_file", the shell immediately creates a 0-byte file at that moment in that location.
(2) And the reason the file at L:\NGS is empty is because the Perl program does not work. It fails with the error and does not print anything in the standard output (STDOUT) that could go to the L:\NGS file.
Now, you should be able to see the error message thrown by Perl. I'm not sure why you're not.
Maybe you are calling your Bash shell script like so?
my_shell_script.sh 2>/dev/null
That will redirect all error messages into the NULL device and you won't see the error message spewed by Perl.
To fix the problems:
(1) Ensure that the Perl program is correct syntax-wise. All opening braces must have corresponding closing braces.
(2) Replace this line in your shell script:
perl 'C:\Users\cmccabe\Desktop\annovar\matrix.pl' < "${id}".txt.hg19_multianno.txt > "L:\NGS\3_BUSINESS\Matrix\Torrent\matrix_"${id}".txt"
by this:
perl 'C:\Users\cmccabe\Desktop\annovar\matrix.pl' < "${id}".txt.hg19_multianno.txt
and run your shell script without the "2 >/dev/null" (if it is so now).
That should print the output to your screen (terminal). If it looks satisfactory, then add the "> L:\NGS\..." part to it.