Adding a login field to sub menu

Good day, and happy Thanksgiving!

I've been struggling with adding a submenu item that contains the Wordpress login form. Basically I have a function that determines if a user is logged in. If they are not, then the rest of this function runs to place the login form as a sub menu item (along with a few other items).

elseif (!is_user_logged_in() && $args->theme_location == 'primary') {
        $items .= '<li><a href="'. site_url('wp-login.php') .'">Log In</a>
         <ul class="sub-menu">
			<li class="menu-item"><a href="http://localhost:8888/help/">Help</a></li>
			<li class="menu-item"> <div>'. wp_login_form().' </div> </li>
		</ul>
        </li>'      ;

The problem is that the login form isn't in the submenu. Instead it becomes it's own item outside the menu.

Any insights would be greatly appreciated!