in keplers second law you said that the planet has equal distance then howcome when we have summer the earth is closer to the sun and in winter the earth is
far away from the sun
As answered previously...
It is basically the tilt of the earth which causes change of seasons. For half of the year the northern hemisphere is tilted towards the sun while for the other half, Southern hemisphere, is tilted away from the sun. The part which is tilted towards the sun would experience summer while the other part would experience winter. This keeps on changing as the Earth moves in its orbit.