AKannan said that he had written a letter
BKannan said that he has written a letter
CKannan said that he had been writing a letter
DKannan said that he wrote a letter
When transforming direct speech into reported speech in the past, you change the tense of the verb from the past simple ("wrote") to the past perfect ("had written") to convey that the action took place before the reporting verb ("said").