The German economy shrank for the second consecutive year in 2024, according to preliminary official figures.