write func. modified for I/P files