ic_write function

Write ics file