Question related to vertex cover The definition of vertex cover is as is:
Set of vertices such that each each has atleast one endpoint in that set. 


In the above example, why can't we consider all vertices as vertex cover since all vertices are endpoints to all the edges.
Your misunderstanding might be a false assumption that there is a unique vertex cover. This is hardly the case – there could be many different ones.

The set of all vertices always forms a vertex cover. However, there are always smaller vertex covers (even in the complete graph!), and we are usually interested in finding a vertex cover which is as small in size as possible.