I believe the scene is created in order to show the power of innocent children as well as the basic good in all men. The men who confronted Atticus at the jail almost certainly planned to lynch Tom Robinson, and their mob mentality would have probably come to fruition if the children had not shown up to impart their own words of wisdom. Atticus alone would probably have not succeeded in restraining the men--either through words or fists--and the sheriff was absent on a wild goose chase perpetrated by the men. However, the group of men singularly were not all bad; although they are not all identified, most of them were probably upright citizens who held jobs and had families and children of their own. It took the simple language of Scout to bring them to reason, and it helps to illustrate that even bad men can be brought to their senses in the presence of children.
This scene is a powerful illustration of the influence of innocence. When Scout and Jem show up at the jailhouse scene, a group of Maycomb County men are threatening to enter the jail where Tom Robinson is being kept so that they may hang him (inference). Atticus refuses to move aside from the jail door, even in the face of intimidation from the lynch mob.
Once Scout arrives and reminds Mr. Cunningham of how she knows his boy Walter, and how Atticus has helped the Cunningham family through the process of entailment, Cunningham influences the other men to lay down arms and return to their homes in a civil manner. Without Scout's interference, this scene certainly would have turned out much differently.
reminded them of their kids
wow you so smart you go to einstein college