Added appendFile helper method