Adding insertEOF function to add [EOF] indicator