If we say that we have fellowship with him and walk in the darkness, we lie, and don't tell the truth.
The second reason why he wrote this epistle is in chapter 2, verse 1 John 1:1 . "These things write we unto you, that ye sin not." And so, the purpose of this epistle is to bring to you a life of victory over sin, to give you power over sin.