Syed Waris Shah wrote it sometime in the 1760s.
The story of Heer and Ranjha, like all such stories, is partly true and partly fiction. But it continues to have such a powerful hold on the imagination of rural folks that they want to believe it to be true.
The events of the story are supposed to have occurred sometime in the middle of the 15th century.
Heer was an extremely beautiful woman born in a wealthy family "Sayyal". Ranjha (Teedo) was the youngest of four brothers, after a confrontation with his brothers, Ranjha left home and travels around and comes to Heer's village, where he found his love, Heer, who offered him a job to take care of there cattle. Having met Ranjha, Heer became mesmerised by the way Ranjha played the flute (Wanjli) and eventually fell in love with him. They would meet each other secrectly for many years until they were caught by her jealous uncle "Kaido" and parents (Chuchak & Malki). Heer was forced to married to another man "Saida Khera", with the full permission of "Mullah" (priest), who was well-payed by Kaido.
Ranjha was left broken hearted and left to walk the quiet villages on his own until eventually met a Jogi (devoted beleiver in God). Having entering Gorak's Tilla (Shrine) Ranjha could only see his departed lover and being emotionally scared he voluntarally became a Jogi. Reciting the name of the Lord "Allakh Naranjjan" on his travels around the Punjab he found the village, where he was reunited with Heer. They escaped (also with Saida Khera's sister "Sehti", who was in love with "Murad Baluch" - an another famous love story of Punjabi Culture) but was caught by Maharajah's police. Maharajah punished him to jail but same night whole city was in flames. Maharajah freed Ranjha and permitted him to marry with Heer.
They came back to Heer's Village, where Heer's parents agreed to their marriage. On the wedding day, Heer's jealous uncle, "Kaido" poisoned her so the wedding wouldn't take place. Having heard the news Ranjha rushed to aid Heer but was too late as she died. Ranjha becoming broken hearted once again and died on her grave.
Amrita Pritam (died 2005), a great Punjabi poet and novelist refers to the pain and anguish, in a different context, though, in her memorable poem, when she addresses Waris Shah in these words:
Ik roi si dhee Punjab di,
Toon likh likh maare vaen
Aj lakkhan dheeyan rondiyan,
Tainu Waris Shah noon kehn
When one daughter of the Punjab wept
You penned a thousand dirges of lament
Today a hundred thousand cry out to you
To make another statement