The letter says it is written so readers may know they have eternal life. It also connects this assurance to believing in the name of the Son of God. See 1 John 5:13.
In 1 John 5:13 the writer states why he has been writing: to help people who already believe in the Son of God’s name be sure they have eternal life and to keep trusting that name. He then draws out what this confidence looks like in prayer: believers can approach God boldly, knowing that requests shaped by God’s will are heard. These verses sit near the close of 1 John, where the writer gathers themes he has been repeating—belief in the Son, assurance, and the practical outworking of that assurance.
These verses close out 1 John’s main aims: the writer addresses people who already believe “in the name of the Son of God,” and he says his writing is meant to produce knowledge—settled certainty—that they have eternal life (verse 13).
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with 1 John 5:13, then read the surrounding section so the answer stays connected to the passage's flow.
13These things I have written to you who believe in the name of the Son of God, that you may know that you have eternal life, and that you may continue to believe in the name of the Son of God.