Programmatically add posts from specific category to menu

I’m not 100% sure if I get you right, but maybe this will solve your problem:

add_filter( 'wp_nav_menu_items', 'fx_user_menu', 10, 2 );

function fx_user_menu( $items, $args ) {
    if ($args->theme_location == 'primary') {
        $myposts = get_posts( array(
            'category' => <YOUR CATEGORY ID GOES HERE>,
            'posts_per_page' => 5
        ) );

        foreach ( $myposts as $post ) {
            // you should not use the_title and the_permalink outside of The Loop - they won't work correctly
            $items .= '<li><a href="' . get_permalink($post->ID) . '">' . apply_filters('the_title', $post->post_title) . '</a></li>';
        }
    }   
    return $items;
}