More than 20 people in Germany have been injured, four severely, after a 17-year-old with an axe went on the rampage on a train.