What exactly is the purpose of a pilot keeping a logbook?
Almost everything in flying is measured in hours, including your experience. 

To start with, in most places you need to have trained a certain number of hours before taking your flying skills test, regardless of how good you are.

And then it continues, want to do an instrument rating, you need x hours. Want to be an instructor, you need y hours. Want to be a Captain on a 747, well you'll need z hours as First Officer first and to be First Officer, you'll need....guess what!

Beyond that, many countries place restrictions on what you can and can't do based on your recent experience. For example, in the UK, to take passengers you must have performed three landings on type within 90 days.

And then it carries on outside of legislation, too - if you want to rent a plane most places will place some sort of hour requirement, whether it be your total hours or hours on type etc.

And so it follows that you need somewhere to log this. As a pilot your log book is sacrosanct - its a legal document forming a factual record of your flying experience.