Pencil tips are made out of graphite. Graphite molecules are flat groups of carbon atoms that are stacked in layers. If you were to zoom in on the graphite, the graphite would be organized in flat sheets. Those flat sheets make the graphite weaker and makes the graphite break into tiny bits. When you write on a piece of paper, the tiny bits of broken graphite stick to the paper, allowing you to write! When you use a rubber eraser, the graphite sticks better to the rubber than the paper, erasing it. That is how pencils are able to write!