How Can I add a menu to the theme from withen the function.php file

I think your current call to wp_nav_menu() may be echoing the menu when the code is seen and not returning it in the function.

Try this call:

wp_nav_menu( array(
    'theme_location' => 'legal_footer_navigation',
    'echo'           => false,
) );

If that works, you can also probably remove the echo parameter from the register_nav_menus() call.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)