pace back and forth
To walk back and forth (in or around some place), as in fear, anger, anxiety, frustration, etc. I hate seeing the animals in the zoo pace back and forth in their cages like that. They all look so unhappy! I just paced back and forth while I waited to hear back from the doctor.
pace back and forth
and pace up and downto walk over and over the same short route nervously or anxiously. The leopard paced back and forth in its cage. I paced up and down, worrying about a variety of things.