<human>:  append to a file
<bot>: Here is some code to append line "cool beans..." to file "foo"

with open('foo', 'a') as f:
  f.write('cool beans...')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.