In and out of the litter box is often a sign of urinary or fecal discomfort.Cats can do this when stressed and can do this in the face of infection or benign inflammation This can be a big problem, even life threatening emergency especially if a male cat.