The problem is that next_post_link
actually prints the link.
If you want to do this as described above, you could use output buffering:
function thelink() {
ob_start();
next_post_link('%link', 'Next →', TRUE);
$next_link = ob_get_clean();
if ($next_link) echo $next_link;
else echo 'Next →';
}