How to Display selected custom post inside gutenberg using shortcode

I have a custom post type “exercise”. I have loaded a bunch of exercise on this post type. I Have a template design for the exercise inside bricks builder. I want to display the exercise on blog posts template using shortcode which i will paste in the gutenberg editor.

I was thinking of creating a shortcode where i will pass the exercise id/name and then it will use the bricks template which will show some dynamic data inside the blog post.

Any idea how can i create this?

I have got a function to create the shortcode but that seems not working for me.

function display_exercise_template($atts) {
    $atts = shortcode_atts(array(
        'exercise_id' => 0,  // Default exercise ID
    ), $atts);

    $exercise_id = intval($atts['exercise_id']);

    if ($exercise_id) {
        // Use the Bricks Builder function to render the template by template ID
        $template_content = bricks_render_template(19038, $exercise_id);

        // Modify the output as needed, e.g., format, styling, etc.
        $output = "<div class='exercise-display'>";
        $output .= $template_content;
        $output .= "</div>";

        return $output;
    }

    return ''; // Return empty string if exercise not found
}

add_shortcode('display_exercise_template', 'display_exercise_template');

It’s not displaying anything. I think there is something wrong with the ‘bricks_render_template’ function but i can’t find what the issue is.

Any kind of help would be highly appreciated.
Thanks and regards.