Here's why:
* Tense inconsistency: You're mixing past perfect ("had been") with present perfect ("have written"). This creates a confusing timeline.
* Subject-verb agreement: The sentence lacks a subject after "had been."
* Word order: The phrase "a long time" should be placed before "I have written to you."
Here are some ways to correct the sentence:
Option 1 (Simple Past): "It has been a long time since I wrote to you."
Option 2 (Present Perfect): "It's been a long time since I have written to you."
Option 3 (Past Perfect): "It had been a long time since I had written to you." (This option implies a specific point in the past, before the time of speaking)
Choose the option that best fits the context and meaning you want to convey.