It is an infinitive functioning as an adverb
Mart Twain renders Huck Finn as a realistic, believable character by casting him as being realistic. Huck is portrayed as being a flawed and imperfect person who is sometimes naive and foolish. Huck, also, speaks in regionalisms, which makes him seem like a real person from his particular area.
What best compares between the two is that Edith and Ottis were Anne's parents and thought that it would be to her best advantage if they didnt tell her what was really going on in the war.