Post the code that you tried. Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Tell us what the code actually does and how that is different from what you want.
Which exact motor shield. Post a link to where you got it.
Non-blocking timing tutorials:
Blink without delay().
Beginner's guide to millis().
Several things at a time.