selftests/cli: test and fix txt and bin write and read functions
This tests txt_write, txt_read, bin_write and bin_read Shell methods.
There were also few issues with it that were discovered during the testing. For example calling prompt twice causes match of new prompt. The output of txt_read was incosistent with text prepresentation in Python.
The new feature here is ability of txt_write to append instead of overwrite.