In a time period particle from equilibrium goes to one extreme again to equilibrium then to other extreme and again to equilibrium.
so, total displacement is zero because particle comes to it's starting point but distance is 4× A because particle travels 4 times the distance A.
So, displacement =0
distance =4A