Yes, you can do like that.
Just copy the configuration from other device and paste in the CLI.
But you are recommended to do that between the same firmware versions, cause there might be some different commands between the different versions, which might cause error when import the configuration.
Also, carefully paste the passwords in the configuration, cause the passwords are stored in cipher charaters, you should edit them before importing.
And, also the RSA keys.
In one word, better to paste the common configuration, such as interface, traffic policy, eth-trunk, routing protocol, modifying the password and other private information before importing.