Get a Post Loop based on Logged in User information into a Shortcode

I can’t get the shortcode to work.

So I see there’s a $args in your code, so if you actually want posts that match those args, then you can create a secondary query/loop like so: (replace all code from the if (have_posts()) : to the wp_reset_query();):

global $post;

// Create a secondary query
$query = new WP_Query( $args );

// Define the variable which stores the shortcode output
$return_string = '';

// Run the custom loop and append the output to $return_string. Remember, no echo!
if ( $query->have_posts() ) :
    while ( $query->have_posts() ) : $query->the_post();
        $return_string .= '<a href="'.get_permalink().'">'.get_the_title().'</a>';
    endwhile;

    wp_reset_postdata(); // restore the $post global - don't call wp_reset_query()
endif;

And be sure to add global $wpdb; at the top in your function because currently the variable is not defined in that function.

Also, please do not echo anything in shortcode functions because for example it can invalidate REST API responses and causes the block editor to fail in saving the post! So be sure to remove that echo implode(...);.