Cannot resolve $variable in awk

My script
----------

for i in `cat n`;do
export k=`echo "CSN: "$i` //combining CSN: and value from n
echo "$k"
awk ''{print "CSN: "$0;}'{_=29}_&&_--' file1|tail -1 >> file2
done

In the above script i cannot able to resolve $k in awk command
file n contains
------------

0000
1111
2222
3333
4444
6666

I am trying to append CSN: 0000 and search it in the file1 and
display the 29th line from the searched pattern

First of all I don't even expect that code you posted to work because I see few syntax errors.

I would suggest you to post few lines from your input files and desired output in code tags.

Also no duplicate post. Follow forum rules.

As Jedi states there are various bugs, I'm no awk expert but I think the line:

echo "$k"

should read:

echo "$k" > file1

so that the awk(1) command has something in the input file (called file1) to work on...