Dear Anshu Kumari,
Due to the electronic transition of n (lone pair) to sigma* (antibonding sigma orbital) which fall under Visible light hence iodine shows violet color.
For that mentioned transition iodine absorb red color light from visible region and emit violet color hence appear as violet.
Lone pair of e absorb energy and shift to sigma antibonding orbital and shows color.
Regards