Not quite. The answer is C.
How to solve it
The helping verb had requires the past participle, which is written. Use wrote for the simple past, as in “Jamal wrote the date,” but use had written to show that the writing was already complete when the bell rang.