In these first Indonesian lessons I've learnt words like "buku" (book), "ini" (this, the) or "aku" (I)....... So, I'm very close to understand the title of one of the best songs by Iwan Fals: "Buku ini aku pinjam" :) https://www.youtube.com/watch?v=aUrMrQaIjC4
They both have the same meaning, but "ia" is more formal than "dia". In writing exercise, your answer should be correct. But if it was listening exercise, you should write exactly what the speaker said.
Should be correct too. However, in daily conversations, we left out the "a" / "sebuah". We'll just say: "Dia menulis buku". Even more informal: "Dia tulis (base form of "to write") / nulis (get rid of the 'me-') buku".