How do I make one-time usable variable?

I’m doing something with license keys and i want them one-time use means if user use them, they cannot be used again, but i have no idea how to make it

You can simply have a database and once the key is used, you remove it from the database or mark it as used

How do i make database?

You should look into a database language like SQLite or MySQL.