just noticed this weird flight path and the altitude gain graph. What could be the possible reason?
If you zoom in on the Flightstats map, you will see that the apparent initial excursion into Kent is made up of straight lines and impossibly sharp turns. Combined with the fact that Flightradar24 doesn't show any such thing, I conclude that it is a data error; the plane didn't actually fly to Kent and back to London.
The Flightradar replay shows that the flight left its Terminal 5A gate at 11:18 UTC, taxied to the runway and took off at 11:36 UTC, and then followed the path via Paris that Flightstats also shows. But Flightstat claims the "actual" departure time as 11:10 UTC. It seems to have invented 20 minutes of teleporting around Kent and Surrey out of thin air.
Possibly Flightstats started by guessing where the plane would be, based on its scheduled departure time of 11:10 UTC, and then, when actual position data started coming in, scrambled to connects its initial guess to reality somehow.