This combination of verses seems to contradict the message that all humanity sins basically all the time. To address the question, I’m going to address v.6 as v. 9 has the same theme in it: that we will not sin as we live in God.
1 John 3:6 – “No one who lives in him keeps on sinning. No one who continues to sin has either seen him or known him.”
The key to this verse is understanding what “keeps on sinning” means. The meaning here is not continuing to sin in individual acts, we all do this and will do this. What it means here is to continue to have a conscience that sins and be at odds with God through a lack of belief in Jesus. When we do not have a relationship with God through Jesus Christ, we “keep on sinning” as a matter of course. John is speaking about being a non-believer here as is concern throughout his book, particularly in 1 John 1.
Another aspect is John’s concern of the end times. He is saying that no one at the second coming of Christ will be able to keep sinning. We will be perfected. Anyone that continues to sin proves that they are not in Him and are condemned.