When ee2 contains multiple non-blank lines, those lines are assigned to the CelDistC variable, thus that variable will in fact contain one or more newline characters, which obviously is causing problems with your awk.
What exactly do you want to capture from the ee2 file? If you want only the first non-blank line from ee2, then exit after that first print command:
Here is an alternate solution which also works for me. I don't know if it will work for you because I am not encountering your problem. When constructing the CelDistC variable, rather than have awk print multiple lines (each terminated with a newline), I have awk separate the lines with the symbolic expression for newline (\n).
Give it a try.
CelDist=5
CelDistC=`awk '{ if (NF>0) if (notfirst==1) printf "\\n" $0 else {printf $0 notfirst=1} }' ee2`
Actually, when constructing your variable, storing and printing from the array does nothing for you. Using printf instead of print is the key, as it keeps the newlines out of it at this point. You can achive the same results with the simplified:
CelDistC=`awk '{if (NF>0) printf $0 "@@@"}' ee2`
But since you are appending @@@ to each and every line from ee2, your end result will have line breaks after each ee2 line, even if only one ee2 line. If you want only line breaks BETWEEN ee2 lines and not after the only or final ee2 line, then do this instead:
CelDistC=`awk '{ if (NF>0) if (notfirst==1) printf "@@@" $0 else {printf $0 notfirst=1} }' ee2`