Input not saving correctly in both files

If the user inputs two variants separated by a comma, the below command is supposed to write both variants to the GJ-53.txt and then to out.txt. Both are written to the GJ-53.txt, however only one is written to out.txt and I'm not sure why. Thank you :).

 gjb2() {
    printf "\n\n"
    printf "What is the id of the patient getting GJB2 analysis : "; read id
	printf "Please enter the coding variant the following is an example"
	echo " c.274G>T"
	
    printf "variant(s), use a comma between multiple: "; IFS="," read -a variant
	        
        [ -z "$id" ] && printf "\n No ID supplied. Leaving match function." && sleep 2 && return
        [ "$id" = "end" ] && printf "\n Leaving match function." && sleep 2 && return

        for ((i=0; i<${#variant[@]}; i++))
              do printf "NM_004004.5:%s\n" ${variant[$i]} >> c:/Users/cmccabe/Desktop/Python27/$id.txt
        done
	add2text ${id}.txt
	cd 'C:' C:/Users/cmccabe/Desktop/Python27/
	printf "NM_004004.5:%s\n" "${variant}" >> c:/Users/cmccabe/Desktop/Python27/$id.txt >> c:/Users/cmccabe/Desktop/Python27/out.txt
	additional
} 

The set -x

+ cd 'C:\Users\cmccabe\Desktop\annovar'
+ echo -n ''
+ cd C: C:/Users/cmccabe/Desktop/Python27/
+ echo -n ''
+ menu
+ true
+ printf '\n Welcome to target gene annotation and mutalyzer (v1), please make a
 selection from the MENU \n
        ==================================\n\n
        \t 1  GJB2 analysis\n
        \t 2  MECP2 analysis\n
        \t 3  Phox2B analysis\n
        \t 4  Syntax checker\n
        \t 5  Name checker\n
            \t 6  Position converter\n\n
        ==================================\n\n'

 Welcome to target gene annotation and mutalyzer (v1), please make a selection f
rom the MENU

        ==================================


                 1  GJB2 analysis

                 2  MECP2 analysis

                 3  Phox2B analysis

                 4  Syntax checker

                 5  Name checker

                 6  Position converter


        ==================================

+ printf '\t Your choice: '
         Your choice: + read menu_choice
1
+ case "$menu_choice" in
+ gjb2
+ printf '\n\n'


+ printf 'What is the id of the patient getting GJB2 analysis : '
What is the id of the patient getting GJB2 analysis : + read id
gj-53
+ printf 'Please enter the coding variant the following is an example'
Please enter the coding variant the following is an example+ echo ' c.274G>T'
 c.274G>T
+ printf 'variant(s), use a comma between multiple: '
variant(s), use a comma between multiple: + IFS=,
+ read -a variant
c.109G>A,c.101T>C
+ '[' -z gj-53 ']'
+ '[' gj-53 = end ']'
+ (( i=0 ))
+ (( i<2 ))
+ printf 'NM_004004.5:%s\n' 'c.109G>A'
+ (( i++ ))
+ (( i<2 ))
+ printf 'NM_004004.5:%s\n' 'c.101T>C'
+ (( i++ ))
+ (( i<2 ))
+ add2text gj-53.txt
+ cd 'C:\Users\cmccabe\Desktop\annovar'
+ echo gj-53.txt
+ cd C: C:/Users/cmccabe/Desktop/Python27/
+ printf 'NM_004004.5:%s\n' 'c.109G>A'
+ additional
+ printf '\n\n'


+ printf 'Are there additonal target gene patients to be analyzed?  Y/N '
Are there additonal target gene patients to be analyzed?  Y/N + read match_choic
e
n
+ case "$match_choice" in
+ id=gj-53
+ nomenclature
+ printf '\n\n'


+ cd C:
+ C:/Users/cmccabe/Desktop/Python27/python.exe C:/Users/cmccabe/Desktop/Python27
/run_batch_job.py C:/Users/cmccabe/Desktop/Python27/out.txt C:/Users/cmccabe/Des
ktop/Python27/out_name.txt NameChecker
+ check
+ printf '\n\n' 

I figured it out. Thank you :slight_smile: