Where was Jim while Huck was at the Grangerfords? Why did Huck go back to the church on Sunday?
While Jim and Huck are floating downstream on their raft, a steamboat hits them and damages the raft. Huck ends up on shore and runs into the Grangerfords who think he might be one of their enemies, the Shepherdsons. When they find out he isn't, they take him in. Meanwhile, Jim hides in a swamp and repairs the raft.
Huck goes back to the church because Sophia Grangerford asks him to go back and get her "testament." But she's really left the testament there on purpose as a way to communicate with Harney Shepherdson, whom she is planning to marry in a sort of Romeo and Juliet, love between the two sides of a feud kind of thing.