Very likely you may have a fungal skin infection in ear canal. It usually causes itching and pain. Or it may be pus from middle ear infection.
Next Steps
Ear examination and suction clearance by an ENT doctor followed by use of antifungal/ antibacterial drops and painkillers.
Health Tips
Avoid water in ears. Avoid using cotton buds to clean ears in the future.