Dear student,
This is because the medicine when exposed to the light may undergo degradation and the chemical constituent may change the medicine.
The medicine may either become inactive or toxic.
Thus they are kept in the dark place to avoid their exposure to light.
Regards