What is a mole(skin marking)?
A mole or melanocytic naevus is a small, dark spot on the skin.
Moles may either be present at birth or develop later in life.
Acquired moles are a form of benign neoplasm, while congenital moles are considered a minor malformation.
Moles are most often of no medical consequence.
Most children are born with moles, and almost everyone has at least one or two moles on their bodies.
As for exposure to sun, this is still not researched:
"Some scientists suspect that overexposure to ultraviolet light (including excessive sunlight) may play a role in the formation of acquired moles, but more research is needed in this area."
Also from another page:
It is the case that moles have a strong hereditary occurrence.