added functionality to create file if not existing in append mode.