Basic Motor Sketch Help pls

I'm new to Arduino and I am trying to get my 2.2mm Dia Shaft 6V 12000RPM Speed Magnetic DC Hair Clipper Motor RS385 spinning using an arduino program.
I connected the collector of my transistor to a diode and the motor in parallel, the base of the transistor to 2.2k resistor and to Pin9 of the Arduino board, and the emitter to ground. The cathode of the diode was connected to the 5V supply of the arduino.
Below is the program I am using but the motor isn't spinning; the transistor though is getting very hot and the led is lighting.
Why is the motor not spinning?
int motorPin = 9;
int led = 13;

void setup(){
pinMode(motorPin, OUTPUT);
pinMode(led, OUTPUT);

void loop(){

digitalWrite(motorPin, HIGH);
if (motorPin= HIGH){ digitalWrite(led, HIGH);

digitalWrite(motorPin, LOW);
if (motorPin=LOW) {digitalWrite(led, LOW);


The cathode of the diode was connected to the 5V supply of the arduino.

NO! That is a very good way to burn out your arduino. You need a separate 6V power supply and make sure the negative line is connected to the GND on the arduino, otherwise the motor won't turn.

Also when comparing two things inside an IF statement or while loop, you need to use ==, a single = is just assigning whatever is on the left to what is on the right.

motorPin = LOW, now motorPin is equal to LOW instead of checking if motorPin is HIGH or LOW "==".

make a diagram , and remember to have a separate power supply for the motor.