[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files....
So:

a=1
b=1
while [ $b -eq 1]; do
b=`sed -n '$ap' test` 
a=`expr $a + 1`
$here do something with b etc
done

the problem is that sed does not seem to recognise the $a, even when trying
sed -n ' $a p'
So, I cannot read line by line this text file...How can I achieve this?

or number of lines?

Reading a file line by line till it reaches a white line:

awk '/^.+$/{ print; next} {exit}' inputfile

Thank you very much!