AnalogWrite() vs. DigitalWrite()

I have a doubt in mind if we are going to connect motors to Arduino such as BO motors while writing the code to run the motor do I need to use analogWrite() or digitalWrite()? by the way, I am using H-Bridge motor shield.

Not enough information
Links to products?
What have you tried?

It depends if you are just switching things on/off (digitalWrite) or trying to control the speed using PWM (analogWrite).

With many motor drivers you use both, digitalWrite() to set direction and analogWrite() to set speed. There are thousands of examples around of people driving motors. Look at a few and you'll get the idea.

Steve