Yes, to distinguish between people and families. Let us say two girls are named Sara. Imagine how it would be like if there was no surname, how will we know which one we are talking about?
Will we say 'Sara, the tall and red headed girl'? Won't it be easier if we say 'Sara David' only ?
It is just used to also recognize families, which members are related to which.
Also if you are searching for someone lost from your family, writing their name and surname might help you finding them rather than just writing one name which millions will be having.