I am by using this script to produce a new custom menu quickly and assign a webpage into it...

if ( !is_nav_menu( 'Header Menu' )) {
    $menu_id = wp_create_nav_menu( 'Header Menu' );
    $menu = array( 'menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'),'menu-item-title' => 'Home', 'menu-item-status' => 'publish' );
    wp_update_nav_menu_item( $menu_id, 0, $menu );

However, what I am stuck on is how you can hook this menu as much as my theme's "Menu Locations".

For instance, my theme registers a menu location...

array('header-menu' => __( 'Main Navigation Menu' ) )


How do i hook the "Header Menu" as much as the "Primary Navigation Menu" area via script?

ie, I'm able to do that by hand in the WordPress "Appearance > Menus" Manager and under "Theme Locations > Primary Navigation Menu" I choose "Header Menu" and click on "Save". I am trying to get this done in script.