HOW BITCOIN WORKS
You can argue that every transaction consists of two components: a lock and a key (used to open your box). You insert a new key into a new box with a different lock after using your key to open the box containing the desired cheque. You require a new key in order to spend from the new box.
Easy enough. A little variety in the system's lock types is also available. Some safes might demand numerous keys, while others would want you to demonstrate that you know a certain secret. There are numerous restrictions that can be put in place.
We refer to our key as a scriptSig. Our scriptPubKey serves as the lock. A closer examination reveals that such components are actually made up of code blocks and data fragments. They come together to form a small program.
This combination is broadcast to the network when you do a transaction. Each node that receives it will run the program, which notifies it if the transaction is genuine or not, and then check it. If not, it will simply be trashed and the locked cash won't be available for use.
Unspent transaction outputs (UTXOs) are the cheques (coins) that you now possess. Anyone who can supply the key that fits the lock can use the money. The lock is the scriptPubKey, and the key is the scriptSig.
Only the individual who can demonstrate possession of this public key will be able to unlock these funds, if the UTXOs are in your wallet. Using the private key that corresponds to the public key stated in the scriptPubKey, you must give a scriptSig that is digitally signed in order to unlock it. Everything will soon make more sense.
Reference
I understand the whole thing you shared. Your content is helpful.