Custom page for creating/editing custom post type

when a shortcode is defined, he has to return HTML output. then to allow the theme to customise data presentation, you can do something like that :

add_shortcode("form_step_2", function ($attr, $content, $tag) {

    // preparing data
    //...


    // result to display

    $template_name = "form/step_2";

    // search the file wp-content/themes/twentytwenty/my_plugin/form/step_2.php
    $template = locate_template("my_plugin/$template_name.php");

    // if the file doesn't exist in the theme
    if ("" === $template) {
        // use the plugin file wp-content/plugins/my_plugin/templates/form/step_2.php
        $template = __DIR__ . "/templates/$template_name.php";
    }

    ob_start();
    require $template;
    $output = ob_get_clean();


    return $output;

});