Why not just:

    echo "option check_signature 1" >> /etc/opkg.conf
    ...

I don't understand sed well enough to know what the `$$a` at the beginning on the pattern means.