Yang sends old config first before sending new config

Below is my yang file.

  container auth {
  tailf:info "Configure NTP authentication keys";
  list server {
    tailf:info "Configured ip addresses";
    tailf:cli-incomplete-command;
    tailf:cli-compact-syntax;
    tailf:cli-sequence-commands;
    tailf:cli-suppress-mode;
    key "serverip";

    leaf serverip {
      tailf:info "ip address";
      type leafref {
        path "/gw-system:ntp/gw-system:server" ;
       }
    }
    leaf key {
      tailf:cli-incomplete-command;
      tailf:info "Authentication key ID for this server";
      type uint32 {
        range "1..65535";
      }
    }
    choice authtype {
      mandatory "true";
      case sha256 {
        leaf en-sha256 {
        tailf:info "SHA256 encryption";
        type tailf:aes-cfb-128-encrypted-string {
          tailf:info "Cleartext Secret";
          }
        tailf:suppress-echo true;
        tailf:validate validate_ntp_auth_key_pwd {
          tailf:dependency '.';
          }
        }
      }
      case md5 {
        leaf en-md5 {
        tailf:info "MD5 encryption";
        type tailf:aes-cfb-128-encrypted-string {
          tailf:info "Cleartext Secret";
          }
        }
      }
      case md5 {
        leaf en-md5 {
        tailf:info "MD5 encryption";
        type tailf:aes-cfb-128-encrypted-string {
          tailf:info "Cleartext Secret";
          }
        tailf:suppress-echo true;
        tailf:validate validate_ntp_auth_key_pwd {
          tailf:dependency '.';
          }
        }
      }
      case sha1 {
        leaf en-sha1 {
        tailf:info "SHA1 encryption";
        type tailf:aes-cfb-128-encrypted-string {
          tailf:info "Cleartext Secret";
          }
        tailf:suppress-echo true;
        tailf:validate validate_ntp_auth_key_pwd {
          tailf:dependency '.';
          }
        }
      }
    }
 }
}

I am facing one small issue with yang.
When I reconfigure the command with different values then yang sends the previous values first before sending the new values.
For example:

ntp auth server 1.1.1.1 key 1 en-sha1 cisco
commit
ntp auth server 1.1.1.1 key 1 en-sha256 cisco
commit

when I try to configure the same command with different values then I receive old values first followed by new values.
The problem with this is that yang sends the old values with confd_vtype as 1 which is C_NOEXISTS because of this my applciation gets crash because my application expect that the type will always be C_BUF

How can I make yang to understand that if the same command is configured with different values then always send new values instead of sending old values first?

I assume you are referring to the oldv parameter from the cdb_diff_iterate() iter function.
Makes sense for your use case that the old value is of type C_NOEXISTS as the choice case did not exist before the pending transaction.
Start a new read-session to the CDB_PRE_COMMIT_RUNNING database to find out which case was set and the value of the content before the pending transaction.