How to extract a data from dna.root file?

In ROOT 6, you need to:

root [0] .> dump.txt
.x dump.cxx
.>
root [3] 

Note also that, in many simple cases, you should be able to use the operating system redirection, e.g.:

[...]$ root -l -q dump.cxx > dump.txt