Your question is not very clear to me, but I think you may intend:
if( $12 == "A" ) {
filename="outdir/Customer_Create_Records.dat" ;
print >> filename;close(filename)
}
OtherwiseWithout the curly braces, the "then" clause of the conditional ends at the first semicolon. As a consequence, you might attempt to write lines to your output file before its name has been defined.