Why was the earth created?
Because of gravity. The Earth was "created" through a process called accretion.
The solar system started out as a big ball of gas and dust some 4.6 Million years ago. Once most of that gas collapsed in on itself to form the Sun, the dust started to clump together. It created small meteorites that bumped into each other and stuck together creating meteors, that bumped together getting bigger and bigger creating planetoids that bumped and stuck and got shaped by gravity until we had the planets.
The Universe does not have a "grand design" or a "purpose".