to and fro
in one direction and then in the opposite direction.
The children were running to and fro, knocking over all the chairs.
Cambridge English Idioms Dictionary