The correct answer is D. Vinay said, “I had been writing a letter yesterday.”
Vinay told me that he had been writing a letter the day before. This means that Vinay was in the middle of writing a letter yesterday, but he stopped writing before he finished it. He may have finished the letter later that day, or he may have never finished it.
Option A is incorrect because Vinay said that he had been writing a letter, not that he will write a letter.
Option B is incorrect because Vinay said that he had been writing a letter, not that he will write a letter.
Option C is incorrect because Vinay said that he had been writing a letter, not that he was writing a letter.
I hope this helps!