But if we walk in the light,
as he is in the light,
we have fellowship with one another,
and the blood of Jesus, his Son,
purifies us from all sin.
John has been telling us about the message. The message that he heard from Christ and is declaring to us. We now know that God is light. Darkness is not allowed to dwell in Him. But he continues on, revealing to us the good news.
Here is an explanation of the belief that John talked about in his now famous statement of God's love: "For God so loved the world, that he gave his one and only Son, that whoever believes in Him should not perish, but have everlasting life." John is now telling us what "belief" looks like.
True belief is a change in our walk.
There are so many passages in the Bible that tell us how this is possible; how mortal man can have a change of walk. But this passage is telling us how we can know if our belief is real.