Under what background did Li Bai write "Early Making Baidicheng"?

In the first year of Su Zong (756), Li Feng was ordered by his father Xuanzong to start a crusade against An Lushan. Li Bai was Wang Yong's aide in Xunyang (now Jiujiang, Jiangxi). Unexpectedly, Su Zong was afraid that his brothers would struggle for power and profit, and declared Wang Yong a traitor and suppressed him by force. The next year, when Li Bai was in exile, he went to this place, Kuizhou Baidicheng, and suddenly got news that the court had granted amnesty to the world because of the drought. Li Bai was ecstatic and immediately put the boat to the east and wrote the famous "Early Interpretation of Baidicheng" to express his feelings. However, after being pardoned, Li Bai still has no place to stand, living in Dongting and Jinling. In 762, Li Jiazhong, the magistrate of Dangtu County, died of poverty at the age of 62.