list.ml: Fix append_ct and create flatten_ct