Abdul, I'll have to challenge you back. I do agree that Huck is institutionally racist but realizes the error of his ways and decides he'd rather go to hell than write that letter to Miss Watson--but he believes the letter will condemn Jim, not free him. Remember, Jim had run off, so notifying his owner of his presence would result in his being hanged for escaping (in Huck's mind, anyway, since he does not know that Jim has been set free). This realization is the climax of the novel, as Huck rejects the norms of society--even to the point of damnation--in favor of a man he loves and trusts.
Tom's mistreatment of Jim goes on and on throughout the "escape" game. Tom knows Jim is free, but he plays out the whole nonsense of notes on plates, pet spiders, eating bed-leg filings, stealing bed sheets, . . . Why doesn't Tom admit what he knows immediately? Because he wants to create an adventure like the ones he has read about.
(Didn't Tom also tell Jim a story in the beginning of the novel just to scare him, and also take his hat and hang it in a tree to make him think spirits took it?)
The "educated" boy plays around at Jim's expense, while the "ignorant" boy shows more compassion and common sense.