Does Malcolm X say why he wrote the book and his purpose for writing it?
I would pay attention to the last chapters of the Autobiography. Of particular note would be the chapter, "1965." Examining this chapter helps to bring out a particular reason that could be used to explain the purpose of the book:
And if I can die having brought any light, having exposed any meaningful truth that will help to destroy the racist cancer that is malignant in the body of America—then, all of the credit is due to Allah.
This idea of seeking to bring about a change in the culture of racism permeating America is one reason why the Autobiography was composed. Malcolm was convinced that his narrative was not that different from others and in relaying his story, he explores those ideas to more people who can identify and authenticate such a narrative. This becomes the ultimate purpose in its composition. I would also pay attention to the Epilogue where Haley, himself, describes his opinions of Malcolm. In this section one can see the profound impact that Malcolm had on the writer himself, helping to cause a sense of retracing history with the writing of the work, "Roots." Such rumination also provides another reason why the Autobiography was composed.