An easy workaround is to use Output control functions:
function shortcode_fn( $attributes ) {
ob_start(); // start a buffer
wanted(); // everything is echoed into a buffer
$wanted = ob_get_clean(); // get the buffer contents and clean it
return $wanted;
}