When a dog walks around before they poop they're trying to find a spot that is clean before they poop.
It has to do with hygiene and some dogs don't want to poop or pee where another dog or cat has done so.
They want to make sure no other dog or cat or other animal has gone poop or pee in the same spot that they plan to poop or pee in.