It's possible, with a mosfet, but there is a better way. It's typically not good to use a mosfet to burn up power with.
A more typical way is to use a hardware timer to generate a Pulse Width Modulation or PWM. A PWM is a pulse type signal where over the course of a timing cycle the power is varied by varying the size of the pulse. I use this type of control in many of my products, and it works very well. The control loop looks like this:
For example if the timing cycle was 1 second, and the you wanted 1% power, you turn on the heater for 0.01 seconds every second, if you want 50% power, then the timer turns on for 0.5 seconds and off for 0.5 seconds during the cycle. Ect...
This link shows how to setup a raspberry pi hardware timer.
Instead of using the mosfet to do the heating, a resistor is used.
The a basic heater circuit is shown below. The mosfet is switched fully on, or fully off. The nice thing about this circuit is if you know how much your duty cycle is, you also know the average power though the resistor, this allows you to calculate how much power is being delivered. In the circuit below, if I were to turn it fully on, it would be producing P=V^2/R => 5V^2/100Ω=0.25W. A 10Ω resistor would give me 2.5W.
simulate this circuit – Schematic created using CircuitLab
You would need to size the mosfet for the current you need, and make sure you get a logic level mosfet that can handle 3.3V to turn on it's gate (unless you get a buffer or other switch with pull up for a higher gate voltage). By sizing the mosfet (or mosfets) you could design a heating control circuit for any heat needed.