Wallets give the impression that a cryptocurrency moves from one wallet to another, but it is not the case. The digital coins always remain in the blockchain and the money flows from a transaction to the next. The input of a transaction is the money made available for spending. The transaction then generates one or more outputs which will constitute the inputs of future transactions.
If the value of a transaction input is greater than its outputs, the remaining value can be claimed as a transaction fee.