How can I save the incoming data to the database?

Pick a database system
Design a table structure
Create code to take data from chat and store in the database.

It’s not really a Twitch API question relevant to this forum.

There’s a lot to consider and many things to take into account, there is no one answer.

Since this is chat data, make sure whatever you are doing meets the Developer Services Agreement.