Help Me On Firebase Chat App

I want to create a messaging application with a login page. I am using the firebase database. Not everyone will be able to see the messages between the sending user and the receiving user, but every time I send a message, the message the user previously sent is deleted. How can I solve this?(Sorry for bad english)

Don't overwrite the previous message.

Search the main Firebase documentation for chat app examples on Realtime Database (NOT Firestore)

can you send a example link

Google this:

firebase realtime database appinventor chat app

https://firebase.google.com/docs/database/android/structure-data

thanks