How we do coding assignments (hiring engineers)
medium.com
medium.com
If you don't do the paperwork, then that means that they own the code (laws may vary on this, of course), and can use it in their own product or sell it to someone else.
Of course, IANAL, but IP management has become an important topic lately, and this is one of the issues.