The two are:
1. I had written.
2. I wrote.
The second means "before now" the writing happened.
The first means "before before now" or "before a time before now" the writing happened.
2. Is one step back, 1. is two steps back in time.
You don't need 1 unless you need to show two different past moments or actions:
As I ate breakfast, I realized I had not slept well.
- For Teachers