And why companies like google have a different domain for each country?
Because it makes it easier to have SEPARATE CONTENT for every country. Content should be static - so if you want English and for example Spanish pages to be indexed, they must have separate url's. One way is example.com/en
- the other is en.example.com
. The later scales better.
First of all is this possible?
Not for you. You need a provider that supports anycast routing.
To do it yourself you need your own internationally routed IP addresses - which are impossible to get for a normal user as the smallest block assigned is more than 4000 addresses (which you must USE) and the costs are high.
If you would get one you would get routing as an AS (Autonomous System) and just publish routes going to the closest server.
So, not for you. But some hosts may support it.
CDN's do it - so you can definitely move your static stuff off to a content delivery network.
What you can do is country prefixes, and then redirect to them from the main domain.