A teacher has admitted stabbing a seven-year-old girl to death at a school in South Korea, officials say.