You have not informed which Mark Twain story you are referring to, which makes it impossible to answer your question. However I can help you by showing what a simile is and what its effect is within a story.
A simile is a figure of speech that has the ability to compare two objects, beings or situations, which are very different from each other, but which have a certain similarity that allows this comparison to be made. In other words, we can say that the simile is a comparison of different but analogous elements.
Within a text, the simile is used to extend a meaning and better explain an argument, making the comparison so that the meaning of something is easily perceived and established.
An example of this can be seen in the following sentence, which was written by Mark Twain: "Dan'l give a heave, and hysted up his shoulders so like a Frenchman, but it wan's no use he couldn't budge; he was planted as solid as an anvil, and he couldn't no more stir than if he was anchored out."