You can... providing the return value of the first command is compatible with the inputs required for the 2nd command.
For instance... you can do: deserialize(gettransaction("TXID_HERE"))
If however your first command is returning something that isn't identical to the type of input needed for the 2nd command, you'll probably need to do some "python" programming and maybe use a "for" loop or something like that to iterate over the collection of addresses or unspent coins etc...
Balance of each address:
for theAddress in listaddresses():
print(theAddress)
print(getaddressbalance(theAddress))
PrivateKeys of addresses with balance:
for utxo in listunspent():
print(utxo["address"])
print(getprivatekeys(utxo["address"]))
NOTES:
- Copy each line one at a time... otherwise weird things might happen
- The spaces at the beginning of each "print" line ARE important
- You'll need to press enter a couple of times to get it to run