PWM Code to for mosfet gate

i can't figure out the error with the code i am not an expert i am still a student so i ask for help