Dear student,
Graphite consists of layers of bonded carbon atoms. Each layer is made up of hexagonally bonded carbon atoms.The forces of attraction between these layers are weak van der Waals forces.Due to this, these layers can slide over each other and thus graphite can be use as lubricant.
Regards