echo puts a space between each two arguments. The shell considers the newline in $num just a word separator (just like space).
lines="a
b
c"
set -x
echo $lines   # several arguments to echo
echo "$lines" # one argument to echo
See this answerthis answer (by the OP himself) for a more detailed explanation.
 
                