Why I can't do a transaction by use sendtoaddress?
I think it did work, but the getbalance function does not work as you expect. The ./bitcoin-cli -regtest help getbalance reveals that getbalance returns


  "The available balance is what the wallet considers currently
  spendable."


The address you generated with ./bitcoin-cli -regtest getnewaddress is probably just a script that routes the funds back into your main account, so it's address is different, but can be spent using the private key in the main account. You can verify this by ./bitcoin-cli -regtest listaccounts and seeing if it returns something like:

{
  "": 10.00000000,
  ...
}


The "" account is the default account, and you can get it's address using: ./bitcoin-cli -regtest getaccountaddress "".

It might be more convenient to generate an address as a new bitcoind wallet account. Try using:

./bitcoin-cli -regtest getaccountaddress "&lt;optional_name&gt;"

Then send the coins to that address and check it's balance using ./bitcoin-cli -regtest listaccounts