After reading your post, it appears you are attempting to implement a DC motor control using what is referred to as Pulse Width Modulation (PWM).
Although it is not clear from your post, the purpose of the LED in the DC motor control circuit.
Are you attempting to create a visual feedback with the LED intensity as a reference to the DC motor speed?
The principle behind PWM DC Motor Control is by maintaining a set frequency, while varying the duty cycle of the square wave you can effectively control the speed of a DC motor.
Obviously a duty cycle of 100% is in effect a study voltage, equivalent to the peak voltage of the square wave.
As you decrease the duty cycle the delivered average voltage drops until you finally reach a duty cycle of 0%.
For unidirectional control, a transistor or Darlington transistor can be utilized. However, for bidirectional control an H-Bridge, like a L298D, is commonly employed.
The appropriate device required to drive a DC motor, is largely dependent on the specifications and requires of the DC Motor being driven.
Whenever you drive a device with an inductor/coil you should ensure there is protective circuitry to protect against Back EMF from the coils magnetic field collapsing, like a diode across the motor terminals and make sure you are have an appropriate base resistor in place.
Simple Transistor DC Motor Driver Schematic:
Here are a few projects you might find of interest using Arduino and PWM:
Using PWM outputs with an Arduino and a LED
High-Power Control: Arduino + TIP120 Transistor
Tutorial 5 for Arduino: Motors and Transistors
Arduino controlling fan or motor speed with PWM
Arduino Programming Part 3
DC motor control with a SN754410 motor driver IC and the Arduino board
**broken link removed**
Secrets of Arduino PWM
Arduino Motor Shield
**broken link removed**
If you post your code and a schematic of your circuit, I maybe able to assist you further.
Hope the info helps in your endeavors,
BigDog