Toto remained in the bag as far as Saharanpur, but while Grandfather was producing his ticket at the railway turnstile, Toto suddenly poked his head out of the bag and gave the ticket-collector a wide grin.

     The poor man was taken aback; but, with great presence of mind and much to Grandfather’s annoyance, he said, “Sir, you have a dog with you. You’ll have to pay for it accordingly.”

     In vain did Grandfather take Toto out of the bag; in vain did he try to prove that a monkey did not qualify as a dog, or even as a quadruped. Toto was classified a dog by the ticket-collector; and three rupees was the sum handed over as his fare.
As a mischievous monkey, Toto tried hard to get out of the bag. As he had set things in a way that Toto couldn't come out, it struggled hard pushing to come out of the bag.

It remained in the bag until Grandfather provided his ticket at the Saharanpur railway gate but suddenly popped his head out of the bag and gave the ticket-collector a broad smile. The narrator's grandfather was irritated as his efforts in keeping the monkey secret had failed, and the ticket collector was greatly shocked by the monkey's appearance.

The funny thing about the ticket-collector was, he thought it to be a dog and so demanded the pay according to the norms of the railway department for Toto. Finally, grandfather's efforts in keeping Toto secret in his bag failed at last. His attempts to prove to the ticket collector that Toto was a monkey and not a dog become unsuccessful. He tried hard to make the ticket collector understand that it was not even a four-foot animal. Finally, grandfather had paid three rupees charge for Toto's ticket too.
Meaning of difficult words:
TurnstileA mechanical gate consisting of revolving horizontal arms fixed to a vertical post, allowing only one person at a time to pass through
QuadrupedAn animal that has four feet
PokeTo appear or stretch out through something
National Council of Educational Research and Training (2006). Moments. The Adventures of Toto – Ruskin Bond (pp. 7-10). Published at the Publication Division by the Secretary, National Council of Educational Research and Training, Sri Aurobindo Marg, New Delhi.