Create a XML-File from Formdata using php, WordPress

I have a form, and out of the data that are submitted from this form I want to create a XML-File and save this file to a specific path.

I dont know how to pass the data to an php file in WordPress. Usually i would just pass the path of the php file in the action attribute and handle the data.

But how do i do this in WordPress?
I created the form without an plugin.

I am new to WordPress and still try to figure things out.

Thats the Form

<form action="???" method="post">
        
        <input type="hidden" name="action" value="XMLBanf">
        
        <label for="name">Name:</label>
        <input type="text" name="name" required="">

        <label for="departement">Abteilung</label>
        <select name="Abteilung">
            <option value="keine_angabe">Keine Angabe</option>
            <option value="vertrieb">Vertrieb</option>
            <option value="it">IT</option>
            <option value="service">Service</option>
            <option value="lager">Lager</option>
        </select>

        <label for="order">Was soll bestellt werden: </label>
        <textarea name="order" cols="30" rows="10" required=""></textarea>

        <label for="reason_order">Grund der Bestellung</label>
        <input type="text" name="reason_order" required="">

        <label for="price">Angebotspreis</label>
        <input type="number" name="price" required="">

        <label for="offer_file"></label>
        <input type="file">

        <input type="submit" name="submit_button" value="Abschicken">
    </form>

then i would try to handle the data

if(isset($_POST['submit'])){
    $xml = new SimpleXMLElement("<?xml version="1.0" encoding="utf-8" ?><order></order>");

    $xml->addChild('name',$_POST['name']);
    $xml->addChild('departement',$_POST['departement']);
    $xml->addChild('order',$_POST['order']);
    $xml->addChild('reason_order',$_POST['reason_order']);
    $xml->addChild('price',$_POST['price']);

    $fileName = md5(uniqid(mt_rand(), true))."banf.xml";
    $asXML= $xml->asXML();
    $file = fopen($fileName, "w+");
    fwrite($file, $asXML);
    fclose($file);
    print_r(error_get_last());

    if(file_exists("./".$fileName)){
        $myXML = file_get_contents("./".$fileName);
        $xml = new SimpleXMLElement($myXML);
        $xmlpretty = $xml->asXML();

        // pretty print the XML in browser
        header('content-type: text/xml');
        echo $xmlpretty;
    }

How do i access this file now?