Using arduino and transistor for motor control
If the PWM frequency is high enough, the ripple in the current through the motor will only be a few percent, though the voltage you see across the terminals will still be swinging from the supply voltage (less the transistor drop) to the diode drop (which will be negative when measured in the same sense as the supply voltage).

Your issue is likely that the frequency you are using is too low. Switching losses, which increase with frequency, but reduce with the speed of transition of the transistor from full conduction to no conduction, will push you to have the lowest frequency that will give a tolerable ripple, and is usually in the 20-30kHz region to avoid audible effects, though some motors which have very low winding inductances will need much higher frequencies or additional chokes in series with the windings.