Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generation