An aggrieved Valmiki cursed the hunter for killing two mating Kronch birds But the curse wasn’t just a curse, it was in the form of Shloka. The very first Shloka. The shloka later became the building block of Valmiki’s magnum opus Ramayana
मा निषाद प्रतिष्ठां त्वमगमः शाश्वतीः समाः । यत्क्रौंचमिथुनादेकमवधी काममोहितम्
Hindi Translation – हे निषाद, तुम अनंत वर्षों तक शान्ति (अथवा प्रतिष्ठा) प्राप्त न कर सकोगे, क्योंकि तुमने कामातुर क्रौंच पक्षियों के जोड़े में से एक का वध कर डाला है
English Translation – Hunter, you wouldn’t be able to attain solace (or glory) because you killed a bird when he was mating with its partner.
Later Valmiki realizes that the shraap (Curse) was a little too much and also realizes that his shraap followed a pattern. There were a total of 32 letters divided in 8 charans.
He called the basic foundational structure a shloka. Shlokas later became the building blocks of Ramayana. Ramayana has 7 Kaands, 500 Sargas (Chapter) and nearly 24000 Shlokas.