I have a Docker container myContainer and two simple batch scripts:
generateShell.bat
@echo off 
echo #!/bin/bash > helloworld.sh
echo ...>> helloworld.sh
runShell.bat
@echo off 
call generateShell.bat
docker exec -i myContainer bash < helloworld.sh
When I run runShell.bat, helloworld.sh runs in Docker container. I want to generate something in helloworld.sh so that writes output to .txt file in container. I tried 
echo echo Hello World > output.txt>> helloworld.sh
but in that case I get only
Hello World
in Windows command prompt and no generated .txt files neither in container nor on host.