To add to the context:
John is instructing the church to distinguish between true believers and imposters.
4:1 "Beloved, do not believe every spirit, but test the spirits, whether they are of God; because many false prophets have gone out into the world."
He also instructs in 4:20: "If someone says, “I love God,” and hates his brother, he is a liar; for he who does not love his brother whom he has seen, how can he love God whom he has not seen?"
Simply put, he's instructing the believers to not only look for the verbal confession, but also the fruit of the confession.