Uses print instead of cat for file writing