They lay in the same box because they are creating a brood of eggs. They put them all in the same box so that when enough is in one pile someone can sit on them and hatch them. It is instinct. The chickens aren't laying eggs for us to eat - they are laying them to reproduce. It is in their best interest to lay them in a pile so they are taken care of.