Choose the Correct Form of Verb

When he had come, I ------------a letter.

write

am writing

was writing

have writing