Original: At last he was transferred back to a gymnasium in Vienna after a recommendation from Exner and worked there until his retirement in 1918.
Simplified: He worked in a secondary school there until his retirement in 1918.