Create a unit with the model of the arrow that you want at the location of the caster, facing the direction that you want. Next, create a periodic timer with the timeout amount set to the update delay that you want (it should be something small, like 0.03 seconds, a smaller delay will give a smoother movement). Now calculate the dx and dy values (the amount the arrow moves each update, use Sin(angle) and Cos(angle) to calculate these values), and store the some things to the gamecache: the arrow unit, the dx and dy values, and the casting unit. Now wait for a suitable amount of time until you know the arrow will be done flying, then remove leaks and end the timer.
For the timer callback function, recover the arrow unit, the casting unit, and the dx and dy values from the gamecache. Next, update the arrow's position with the dx and dy values, and check if there are any applicable targets within 140 (or another small range value) range of the arrow unit. If there are, choose a random one, create a dummy unit with a modified Storm Bolt skill, set the skill level to a formula based on the distance traveled, and order it to use Storm Bolt on the chosen unit, then have the casting unit damage it for an appropriate amount. Now remove the arrow unit and wait for the starting function to clean everything up.