how to do a one time task in arduino ????

You have a DC motor wired directly to the digital pins?
No other supporting hardware? Shield? Transistors?

What type of motor?

Is everything working as you expected? Whats the end goal of your project?