Follow-up of #16502 to refactor the logic of statement execution in `datafusion-cli`. Based on [comment](https://github.com/apache/datafusion/pull/16502#discussion_r2167502727)