If you have found a job in Germany in the six months: you can apply for a German working visa/residence permit from within the country. There is no requirement of going back to your home country and applying for a German work visa from there.

If you have not found a job in Germany in the six months: you will have to return to your home country.