Dear @Ash,
Welcome to the Wefugees Community and thank you for reaching out to us.
First of all, I am sorry to hear that you have been struggling a lot in Germany. I am not sure, though, if I fully understand your question. As you are holding an Aufenthaltsgestattung, I assume that you applied for asylum and that the procedure is still pending. Of course you are not imprisoned in Germany and you are free to leave the country. However, the Aufenthaltsgestattung will expire and you would not be able to re-enter the country.
In order to travel you are also obliged to hold a valid passport. In case you submitted your passport to the authorites once you applied for asylum you need to contact them and declare that you are planning to leave/quit the asylum process. Which further documents (visa etc.) may be needed depends on your destination country and the respective requirements. If you are travelling directly to your country of origin, you probably won't face further difficulties.
Are these information helpful? In any case, please don't hesitate to specify your question or get back to us with any further questions.
All the best,
Meike