Прочитать примерно так:
read_file_by_lines(Name, Mode, Array) ->
{ok, Device} = file:open(Name, Mode),
read_each_line(Device, []).
read_each_line(Device, Accum) ->
case io:get_line(Device, "") of
eof -> file:close(Device), array:from_list(lists:reverse(Accum));
Line -> read_each_line(Device, [Line | Accum])
end.
Записать можно так:
write_file_by_lines(Name, Mode, Array) ->
{ok, Device} = file:open(Name, Mode),
lists:foreach(
fun(Line) -> io:write(Device, Line)
end,
array:to_list(Array)),
file:close(Device).