You can > ein Buch schreiben that denotes the whole work, from start to finish. And if you say > ich habe ein Buch geschrieben we know you have finished the book. And you can > an einem Buch schreiben which denotes being busy working on a book. And if you say > ich habe an einem Buch geschrieben then we know you have been working on a book, but whether you have finished it or not is not said (most probably you have not, otherwise you'd been using the first phrase). Also, compare the English *I wrote a book* vs. *I was working on a Book*. The same is obviously valid for any kind of book, including autobiographies.