So basicly here u need 2 command blocks (well u should be in creative so a command block) and a repeating redstone signal (it must be fast). To set it up place the 2 command blocks so they are powered by the signal and copy the first command in the first command block and the second command in the second command block. That it! (though you may want to speed up the repeating redstone signal).