cannot modify header information – headers already sent by wordpress plugin

I am creating a gateway plugin but I get this error:

Cannot modify header information – headers already sent by (output started at C:xampp4htdocsmahakwp-includesclass.wp-styles.php:214) in C:xampp4htdocsmahakwp-contentpluginssoolefrontform.php on line 44

and this is my code:

<?php
function soole_form_shortcode(){
    if ( isset( $_GET['status'] ) ){
        require plugin_dir_path( __DIR__ ). '/gateways/payir/verify.php';
    }
 
 
   $form_page = get_option( 'soole_payment_thankyou_page' ); 


    $content = '<form action="#" method="post">';

        $content .= '<label for="gateway-zarrin">زرین پال</label>';
        $content .= '<input type="radio" name="gateway" id="gateway-zarrin" value="zarrin">';
        $content .= '<br />';
        $content .= '<label for="gateway-payir">پی آی آر</label>';
        $content .= '<input type="radio" name="gateway" id="gateway-payir" value="payir">';
        $content .= '<br />';
        $content .= '<input type="submit" name="submit" value="submit">';

    $content .= '</form>';
    
    return $content;
    ob_end_clean();


}
add_shortcode( 'soole_form', 'soole_form_shortcode' );

function soole_redirect_form_to_gateway(){
 
    if ( isset( $_POST['submit'] ) ){
        ob_start();
        $api = 'test';
        $amount = "20000";
        $mobile = "09928615088";
        $factorNumber = "286542";
        $description = "توضیحات";
        $redirect = 'http://localhost/mahak/soole-form/';
        $result = send($api, $amount, $redirect, $mobile, $factorNumber, $description);
        $result = json_decode($result);
        if($result->status) {
            $go = "https://pay.ir/pg/$result->token";
            header("Location: $go");
        } else {
            echo $result->errorMessage;
        }
    
    }

}



add_action ( 'wp_head', 'soole_redirect_form_to_gateway' );

I appreciate all your helps.