Airplane lights | Why do airplanes have red & green lights at wing ends ?

Why green & red lights on wing ends ? Airplane lights

We all do know what headlights & side lights/indicators are for on our motorbikes and cars but what are those blinking lights on an aeroplane ? Why do we need them & other airplane lights ? Long time ago, I had this question that why aircrafts have flashing lights on…

SURPRISE ME !