根据以下输入，在句子中正确地使用逗号和句号。

John said hello to his neighbor Jim and then walked to the store where he bought some apples oranges and bananas.
John said hello to his neighbor Jim, and then walked to the store. There, he bought some apples, oranges, and bananas.