One of the defining elements of Mark Twain's literary style is the way that he attempts to add realism to his writings and works through attempting to record the precise way in which other characters speak. Rather than writing all of his works in popular English that actually only a few people really speak, he gives characters the chance to speak in their original dialects, which greatly augments the way in which they are presented and gives us a real flavour of who they are and where they come from.
Thus it is that in works such as The Adventures of Huckleberry Finn, Twain allows Huck to speak in his "own" voice, with his dialect and poor grammar, to help us enter Huck's world and see things from his perspective. In the same way, in his various accounts of travelling around the world, Twain tries to present the dialect and accent of the various characters that he comes across, often with great success. For example, in his account of his travels to Europe, which he entitles Innocents Abroad, he records the poor English of the French guide who tries to cheat them with hilarious results.