Syntax error using Awk

more report2.txt

how to modify the AWK to print above out put for given n no of inputs using report2.txt file?

out put should be

try this,

awk '{print "A."$0,"=","B."$0,"AND"}' infile | sed '$s/AND/WHERE/'
awk 'NR-1{printf "A.%s = B.%s and\n",n,n}{n=$1}END{printf "A.%s = B.%s where\n",n,n}' infile

Thanks pravin and danmero ,

yes both are working for me .