Hi @RahulK,
Thanks for posting your query in Q&A forum.
Instead of running the commands in the VM, you can directly copy the contents of input.txt into output.txt from the python code and run this code in Azure python function. You can use the input and output blob bindings of Azure functions or use the blob python SDK in the python code and deploy to Azure python function. This might be a simpler approach.
If you would still like to run commands in VM from python functions, please let me know.