flatten binary tree to lined list