They were written to encourage Christians everywhere in their faith and to combat false teachings. The church wasn’t very old but was already fighting a two front battle: Externally, against the Romans and other persecutors, and internally against false teachers. Depending on where you live in the world, those battles continue to this day.
Some people were teaching that Jesus was just a spirit. John shows how Jesus had a real body.
John mentions love a lot, but he also teaches clear and important doctrines such as the exclusivity of Christ:
1 John 3:1 How great is the love the Father has lavished on us, that we should be called children of God! And that is what we are! The reason the world does not know us is that it did not know him.
1 John 5:11-12 And this is the testimony: God has given us eternal life, and this life is in his Son. He who has the Son has life; he who does not have the Son of God does not have life.
Read and enjoy these wonderful books!