If you want to read the application server configuration file (e.g. standalone.xml or domain.xml) directly from the CLI all you need to do is executing the command :read-config-as-xml. This can be useful to be executed as part of a script, so that you can redirect the standard output to a file, like in the following example:
./jboss-cli.sh -c --controller=localhost:9990 --user=admin --password=Password1! --command=":read-config-as-xml()" > myconfig.xml
On the other hand, if you want to reverse engineer the application server’s configuration, then we recommend using the Profile cloner tool, which is discussed in this tutorial: Reverse engineer your JBoss AS-WildFly configuration to CLI