How is it possible for a miners to deduct the transactions fees from the UTXO output which is locked by locking script or encumbrances?
The sum of a transaction's inputs must be greater than or equal to the sum of outputs as part of the validation rules. This difference is the transaction fee.
So to answer your question directly, when a UTXO is spent, it is referenced as part of a transaction input. A UTXO is always completely consumed (analogous to how if you spend a dollar bill, you have to spend the whole bill and get change), so the fees are not taken from that per se. It is the difference of the inputs (sum of the UTXO values being spent) and the outputs of a properly formed transaction that becomes the miner's fee.