Paul Roe also hit a woman over the head with a piece of wood in front of her three-year-old child in a random street attack.
-> The worst places in Leeds for violence and sex offencesIn another incident the 25-year-old followed two schoolgirls and made graphic sexual comments before throwing a large stone at one of them.
Roe was given a ten-year extended sentence after a judge described him as a serious risk to the public.
Leeds Crown Court heard Roe walked up to the 17-year-old girl at Dewsbury bus station on July 20 this year and grabbed her by the hair.
CCTV footage showed Roe punching her to the back of the head 17 times.
The victim fell to the floor and Roe kicked her twice in the back.
The attack ended when members of the public intervened.
The court heard Roe approached the same girl months earlier and made sexual remarks to her.
On September 29 last year he approached a couple and became abusive as they were out with their three-year-old daughter on St Johns Road, Huddersfield.
They called the police as Roe continued to follow them. Roe then approached the woman holding a length wood.
She crouched down and put her bag on top of her head to defend herself as Roe struck her with the weapon.
The wood broke during the attack. Her husband suffered a broken finger as he tried to defend his wife.
-> Counter terror police investigating Neo-Nazi group search property in LeedsOn May 16 this year Roe followed two girls, aged 14 and 15, as they walked along Halifax Road, Dewsbury, in school uniform.
Roe followed the girls and made sexual comments to them.
The girls went into a shop to ask for help but Roe waited outside.
The defendant continued to follow them when they left and threw a large stone which struck one of the girls on the arm.
At the time of the incident Roe was the subject of a sexual harm prevention order for a sexual offence against a young girl.
Roe, of no fixed address, but previously of Maythorne Avenue, Batley, pleaded guilty to three offences of assault occasioning actual bodily harm, two of inciting a child to engage in sexual activity, possession of an offensive weapon and two of breach of a sexual harm prevention order.
Nicoletta Alistari, mitigating, said the offences occurred at a time when Roe's mental health had seriously deteriorated and his mother was desperately trying to get him help.
Ms Alistari said Roe was intelligent and a talented musician.
Roe was told he must serve a custodial term of four years followed by en extended six-year period on licence.
Recorder John Thackray said: "These offences represent a a very disturbing and long-running pattern of offending by you."