About 22,000 students in England were told they were given loans by mistake and must immediately pay the money back.