Adding additional html to the end of the root level in a custom nav walker

Hope this code will helpful for you, add the items_wrap in wp_nav_menu to merge li’s

<?php
 wp_nav_menu( array( 'theme_location' => 'primary', 'container' => '', 'menu_id' => '', 'menu_class'=> '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s<li><a href="http://www.example.com/contact">Contact</a></li><li><a href="javascript:void(0);">Search</a></li></ul>' ) ); ?>