Barack Obama's purpose in writing the book A Promised Land was to help cement his legacy and to communicate his thoughts on where America is in its progress toward providing equality to its citizens.
Most, if not all, presidents write a memoir of their road to and time in the White House. Many also create libraries to help solidify their legacy. Obama, as America’s first Black president, likely sees his role as continuing to provide social commentary on how the nation is doing with regard to the treatment of all of its citizens.
The title A Promised Land suggests that equality and prejudice will be themes he explores in the book. A Promised Land is a play on the biblical concept of the Promised Land the children of Israel sought after they achieved freedom from slavery under the Egyptian pharaoh. This biblical theme of getting to the Promised Land was adopted by the civil rights movement under the Reverend Dr. Martin Luther King Jr.
For Obama, who was involved in community affairs and organizations for social change from an early point in his life, keeping the country moving in a progressive direction toward greater freedom and equality for all is a goal. Since his time in the White House, the country has been confronted by a rise in populist sentiment and, in many ways, a step back from some of the goals that Obama has espoused. His motivation in writing the book is to help clarify issues about social progressiveness.
He notes that America has sometimes fallen short of the ideals laid out by the Founding Fathers, and he discusses various types of inequality and prejudice in the book, including the injustice he sees facing people of color, women, the LGBTQ community, and others. Obama believes that each individual can play a role in advancing the country toward greater equality so that it truly can become the "land of the free" and not just hold out the promise of being such. Thus, it seems likely that he wants to inspire people to act according to the precepts laid out in the Constitution by encouraging readers to understand that greater freedoms for oppressed minorities will not threaten the overall fabric of society.
If the civil rights movement helped set the country on the road to the Promised Land, Obama wants to make sure that people understand that we have not yet arrived. Moreover, it is likely that the journey forward will be constant and that we will never fully get to a point where we have eradicated all injustice from the system.
Obama sees the rising conflict between democracy versus nationalism and what he terms "older forms of identification, tribalism [and] racial prejudice," and he wants to help overcome this conflict. The goal to which he has aspired his entire adult life is to create a country where all people can pursue their dreams without fear of confronting impediments because of the color of their skin, their gender, or how they self-identify. In an interview he gave regarding the book, he places responsibility on individuals and advocates that each person behave in a way that advances freedom for all and cooperate with others based on the idea that "each person has dignity and respect."