Mahabharata is longest version consists of over 100,000 Sloka or over 200,000 individual verse lines,so such big lines of epic how much time it has taken to write ?
As per Mahabharata: Adi Parva: Chapter 62, Krishna-Dwaipayana Vyasa took three years to compose the Mahabharata:
The history of the exalted birth of the Bharata princes is called the Mahabharata. He who knoweth this etymology of the name is cleansed of all his sins. And as this history of the Bharata race is so wonderful, that, when recited, it assuredly purifieth mortals from all sins. The sage Krishna-Dwaipayana completed his work in three years. Rising daily and purifying himself and performing his ascetic devotions, he composed this Mahabharata.
The original version of Mahabharata composed by Sage Vyasa by name Jaya, contains 8,800 Slokas only. Later it was expanded to 24,000 Slokas Bharata. Still yet a later period it was expanded to Mahabharata containing 1,00,000 Slokas.
I am (continued Sauti) acquainted with eight thousand and eight hundred verses, and so is Suka, and perhaps Sanjaya. From the mysteriousness of their meaning, O Muni, no one is able, to this day, to penetrate those closely knit difficult slokas.
Vyasa executed the compilation of the Bharata, exclusive of the episodes originally in twenty-four thousand verses; and so much only is called by the learned as the Bharata
After that he executed another compilation, consisting of one hundred thousand in the regions of mankind.
So coming to the aspect of time taken for composing the Mahabharata, we have to remember that it depends on which version We are talking about.