How can I add a shortcode to query Custom Post Type with ACF in WordPress?

I ultimately figured out getting a shortcode to work by reworking the code to the following:

add_shortcode( 'gr_shortcode', 'gr_shortcode' );
function gr_shortcode() {
    $buffer="<h3>Upcoming Titles</h3>";
    $q = new WP_Query(array(
        'post_type' => 'game_release',
        'posts_per_page' => 3
    ));
    while ($q->have_posts()) {
        $q->the_post();
        $buffer = $buffer.get_the_title().'<br>'.$buffer.the_field('release_date');
    
    }
    wp_reset_postdata();
    return $buffer;
}

tech