How to add and submit input fields using a shortcode?

You can create the shortcode like this:

add_shortcode( 'add_fields', 'input_fields' ); 
function input_fields( $atts ) {
    if ( isset( $_POST['gg'] ) ) {
        $post = array(
            'post_content' => $_POST['content'], 
            'post_title'   => $_POST['title']
        );
        $id = wp_insert_post( $post, $wp_error );
    }
    ?> 
    <form method = "post">
        <input type="text" name="title">
        <input type="text" name="content">
        <input type="submit" name="gg">
    </form>
    <?php
}

It’s just a sample usage, you can check in detail here.