Angle of deflections of the two prisms need to be equal and opposite. While the first prism splits the light in the seven colours due to different angles of deflection, the second prism combines the spectrum along a single ray and the colours again combine to give white light as the emergent light.