GPS _ automaticly back to home option

Hey:
i am working on a project to make a car could detect the home position and where ever it is when i push a switch it calculate the angle between it's current position and home position then it turns to this angle and then go to home.

i am using GPS and Magnetometer, what i am thinking to do is...
GPS to detect the lat and log then calculate the angle between them
Magnetometer to turn the car till reached the angle calculated by GPS coordinates
when magnetometer done, the car with turn on the motors till reach to home position (assume there no any obstacles on the way)

so is this true or i need to modify my thinking, and if any one worked on similar project could provide the code to help?

That is the basic outline of the correct approach. Do you plan to avoid obstacles?

There are many, many details to be worked out, some of them are rather complex, and no one has code to control your car.

This is a very large project and you will need to take time to learn how each step should work and code that step. Plan on several months if you don't know programming well.

Start with the car and learn how to control it.
Learn how to read the GPS and calculate bearing information.
Learn to use PID to steer according to the bearing and magnetometer readings.