This is called
Palilalia, and was frequently depicted by the character Brick Heck in the TV series
The Middle.
Information is provided by PubMedCentral (PMC), National Center for Biotechnology Information (NCBI), US National Library of Medicine (NLM), National Institutes of Health (NIH):
Palilalia is the delayed repetition of words or phrases and is emitted by individuals with autism and other developmental disabilities. Behavioral research suggests that antecedent conditions can be manipulated to decrease the occurrence of palilalia and that it can be replaced with appropriate responses. Consequently, a variety of interventions designed to train appropriate responses have been investigated including scripts, mand training, and rule-governed or self-monitoring tactics.