Mucus in the respiratory system is for trapping microbes that are potentially pathogenic/harmful or which can transmit communicable disease, and large particles entering your lungs and causing damage and/or irritation.
Cilia are for “wafting” the mucus out of the trachea and bronchi, and moving the mucus (and particles/microbes trapped by it) out of the respiratory system and into the throat, where it’s swallowed or expelled by the body.