I have a boost circuit. When the gate is low a short circuit appears
Your code isn't a boost converter.  Depending on how things really run, it may not be switching the output at all.
You need to be generating a pulse width modulated (PWM) signal.  The Arduino has them, and misleadingly calls them &quot;analogWrite.&quot;   It actually generates a PWM signal with the pulse width set by the &quot;analog&quot; value.
Use analogWrite to drive the MOSFET gate, and connect your A0 input to the high side of the 10 ohm resistor.  Measure the voltage, divide by 10, and you have your load current.
Raise the analog output if the current is too high, lower the analog output if the current is too low.
The analog (PWM) outputs of the Arduino only range from 0 (full off) to 255 (full on.)  That might be too coarse for your use - it may &quot;hunt&quot; up and down all the time because one step is too high and another too low.
The Arduino Timer1 library can help if the control is too coarse.  It allows PWM control with 1023 steps.
You'll want to do some averaging on the current measurements, or use a resistor and capacitor as a low pass filter - or, do both.  A hardware filter and some software averaging.

Watch that A0 input.  You are generating high voltage pulses.  They will easily be higher than the allowed 5V on the Arduino input.
Figure out how how the voltage across the load resistor might be, then use a voltage divider and a diode clamp to keep the voltage on A0 at or below 5V.
As an example, a 1 ampere load current through the resistor will require 10 volts across the resistor.  You would need to divide the voltage by 2 to get it low enough for your Arduino to safely handle - and you'll have to account for that in your program.
In any case, you have to allow for the 12 volt power supply - you'll need to use a voltage divider because the voltage across the resistor can be 12V any time the PWM isn't running.

Keep the power rating of the load resistor in mind.  A load current of 1 ampere through a 10 ohm resistor would mean 10 watts of power.  That's a big resistor in comparison with the other parts of your circuit.

That's a lot of information.  Look up anything you don't recognize.  Ask additional questions about anything you can't understand even after looking it up.

Nice idea to use a boost converter to vary the load current.  Some folks don't realize that boosting the voltage means drawing more current from the low voltage side.