awk to compare files and validate order of headers

The below awk verifies the count and order of each text file in the directory. The script does execute and produce output, however the order of the headers are not compared to key . The portion in bold is supposed to do that. If the order of the headers in each text file is the same as key , then the file is good else the out of order header is printed. I am not sure what I am doing wrong. Thank you :).

file.txt tab-delimited in /home/cmccabe/Desktop/validate/*.txt --- each text file ( usually 3) are the same format or should be ----

Index	Chr	Start	End	Ref	Alt 	Inheritence	Score	Quality	HGMD	Classification
1	1	10	100	A	-	.	2	GOOD	.	VUS
2	1	100	1000	-	C	.	5	STRAND BIAS	.	Benign
3	5	50	500	AA	T	.	1	GOOD	.	Benign

key tab-delimited --- order of each header (always the same) ----

Index	Chr	Start	End	Ref	Alt	Inheritence	Score	Quality	HGMD	Classification

awk

logfile=/home/cmccabe/Desktop/validate/process.log    # define log
for f in /home/cmccabe/Desktop/validate/*.txt ; do        # start loop
     echo "Start header validation creation: $(date) - File: $f"     # start entry for file in log
     bname=`basename $f`     # strip off path from filename
     awk '   # call awk
FNR==NR {  # process lines in fields
    for(n=1;n<=NF;n++)  # iterate through headers from file  
        a[$n]    # define array N
    nextfile     # next
}
NF==(n-1) {   # check header count matches key file
    print FILENAME " file has expected number of 11 fields"   # good message
    nextfile    # next
}
{
    for(i=1;i<=NF;i++)  # iterate through headers from file
        b[$i]   # define array b
    print FILENAME " is missing header for: "   # bad message
    for(i in a)    # compare each header to array a
    if(i in b==0)  # if header not found
        print i  # print missing header
    nextfile    # next
}
{
    for(n=1;n<=NF;n++)   # iterate through headers from file
        a[$n]   # define array N
    nextfile   # next
}
NF==(/home/cmccabe/Desktop/validate/key) {   # check order of headers in file to key
    print FILENAME " has expected header order"    # good message
    nextfile   # next
}
{
    for(i=1;i<=NF;i++)   # iterate through headers from file
        b[$i]   # define array b
    print FILENAME " header is out of order for: "  # bad message
    for(i in a)    # compare each header to array a
    if(i in b==0)   # if header out of order as compared to key
        print i   # print header
    nextfile   # next
}' /home/cmccabe/Desktop/validate/key $f    # define compare file (key) and each text file ($f)
done << "$logfile"    # store in log and close loop

current output

Start header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file1.txt
/home/cmccabe/Desktop/validate/file1.txt file has expected number of 11 fields
End header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file1.txt
Start header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file2.txt
/home/cmccabe/Desktop/validate/file2.txt file has expected number of 11 fields
End header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file2.txt
Start header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file3.txt
/home/cmccabe/Desktop/validate/file3.txt file has expected number of 11 fields
End header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file3.txt

desired output

Start header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file1.txt
/home/cmccabe/Desktop/validate/file1.txt file has expected number of 11 fields
/home/cmccabe/Desktop/validate/file1.txt file has expected header order
End header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file1.txt
Start header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file2.txt
/home/cmccabe/Desktop/validate/file2.txt file has expected number of 11 fields
/home/cmccabe/Desktop/validate/file2.txt file has expected header order
End header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file2.txt
Start header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file3.txt
/home/cmccabe/Desktop/validate/file3.txt file has expected number of 11 fields
/home/cmccabe/Desktop/validate/file3.txt file has expected header order
End header validation creation: Fri Apr 21 07:39:09 CDT 2017 - File: /home/cmccabe/Desktop/validate/file3.txt