You probably loose that whitespace because of
Replace it with
in both instances, as echo will interpret $line as a collection of separate arguments instead of a single argument that contains space characters.
But then, the sed command should work fine unless $myval contains "/". Note that you may use any other character for that purpose in sed, as in
sed "s|^default=.*|default=$myval|" /etc/lilo.conf > /tmp/lilo-copy.conf