What are boogers for?

Its actually the defensive process of the nose. Your body secretes mucus for the inside of your nose. This layer protects the constantly wet area inside the nose and captures foreign material like dust and makes solid matter, Boogers.
Your mucus should be clear or white - if you notice odd colors like red, yellow, or green, it usually means an infection, so you should see a doctor if this happens.