You can't with your current structure, at least not without something crazy like inspecting the terminal (which might well not exist).
The right way to do this is by redirecting standard out before you call the other functions:
import sys
def a():
print("abc,")
def b():
print("help,")
def c():
print("please")
def main():
original_stdout = sys.stdout
sys.stdout = open('file', 'w')
a()
b()
c()
sys.stdout = original_stdout
main()
# now "file" contains "abc,help,please"
However, it's also worth asking why you want to do this at all – there are many more straightforward ways to write to a file that don't involve messing with stdout, which might have unintended consequences. Can you describe your use case a little more fully?