Contact the consular representation of your country of origin for information about returning home.
The Federal Office for Social Security (FOSS) provides information here about the social security-related issues that may arise when permanently returning to a third country.