He was later arrested by the police.
The incident took place on Maharshi Karve road on March 21, when the girl, a std 9th student, was returning home after school.
Premkumar Yadav, the accused, allegedly began to follow her, and when the girl tried to hurry, he allegedly held her hand and threatened her with a knife.
The girl managed to run home, and told her grandmother about the incident.
Her grandmother, who is 67 years old, rushed to the spot, and catching hold of Yadav, gave him a thrashing.
"A case under the Protection of Children from Sexual Offences Act (POCSO) was registered against Yadav," said a senior police official. Local court remanded him in judicial custody.