Actually, she's right. Here's another version, but inverted.
If I had been writing the letter, the letter would have been being written.
In other words:
If I had been writing the letter, the letter would have been in the process of being written.
If I had been doing the task, the task would have been (in the process of) being done.
The question is, who writes English like that? Does your teacher believe in torture?