Question: has written or had written?
Answer: "Have written" is present perfect, whereas "wrote" is simple past. This website explains it pretty well. Present Perfect refers to completed actions which endure to the present or whose effects are still relevant. Use the past tense to indicate past events, prior conditions, or completed processes.