Input type search in Menu

This is fine, but you if you want things to look “cleaner” and be easier to modify you could instead create a new file menu-search.php and add your HTML there then tweak your function a bit (don’t forget to prefix your functions)

function myprefix_add_search_box_to_menu($items, $args) {
if ( $args->theme_location == 'menu-1' ) {
    ob_start();
    get_template_part( 'menu-search' );
    $items .= ob_get_clean();
}
return $items;

}
add_filter(‘wp_nav_menu_items’, ‘myprefix_add_search_box_to_menu’, 10, 2);