How can I send data from MySql DB to another MySql data base

I have these issue, I want to take this information from an existent DB and the use a split to get just the first char from the information including date, and send to another DB using JavaScript. This is an electron app, so I need to use these technologies.

// Importar el módulo ipcRenderer de Electron
const { ipcRenderer } = require('electron');

// Obtener el botón y el campo de búsqueda
const searchButton = document.getElementById('BotonBuscar');
const searchInput = document.getElementById('BuscarUsuario');

// Función para formatear la fecha de nacimiento
function formatFechaNacimiento(fechaNacimiento) {
    var fechaCompleta = new Date(fechaNacimiento);
    var dia = fechaCompleta.getDate().toString().padStart(2, '0');  // Asegura dos dígitos
    var mes = (fechaCompleta.getMonth() + 1).toString().padStart(2, '0');  // Asegura dos dígitos, suma 1 porque getMonth() devuelve 0-11
    var año = fechaCompleta.getFullYear();
    return dia + '/' + mes + '/' + año;  // Cambia '/' por '-' si prefieres "DD-MM-YYYY"
}

// Función para cargar y mostrar los usuarios en la tabla
function loadUsers(users) {
    // Selecciona el cuerpo de la tabla donde se mostrarán los usuarios
    const tbody = document.querySelector('#userTable tbody');
    
    // Limpia las filas existentes en el cuerpo de la tabla
    tbody.innerHTML = '';

    users.forEach(user => {
        // Crea una nueva fila de tabla para cada usuario
        const row = document.createElement('tr');
        
        // Formatea la fecha de nacimiento para cada usuario
        const fechaFormateada = formatFechaNacimiento(user.Fecha_Nacimiento);
        
        // Llena la fila con los datos del usuario y botones de acción
        row.innerHTML = `
            <td>${user.Id}</td>
            <td>${user.Primer_Nombre}</td>
            <td>${user.Primer_Apellido}</td>
            <td>
                <button class="btn btn-outline-warning">Editar</button>
                <button class="btn btn-outline-danger">Eliminar</button>
                <button class="btn btn-outline-success" type="button" data-bs-toggle="modal" data-bs-target="#modalcrear">Agregar</button>
            </td>
        `;
        
        // Agrega la fila al cuerpo de la tabla
        tbody.appendChild(row);
        //I need to take this elements into a new var to manipulate them before send to the other DB
            document.getElementById('primernombre').value = user.Primer_Nombre;
            document.getElementById('segundonombre').value = user.Segundo_Nombre;
            document.getElementById('primerapellido').value = user.Primer_Apellido;
            document.getElementById('segundoapellido').value = user.Segundo_Apellido;
            document.getElementById('fechaNacimiento').innerText = formatFechaNacimiento(user.Fecha_Nacimiento);
    });

}

// Manejar el evento de clic del botón de búsqueda
searchButton.addEventListener('click', () => {
    const idUsuario = searchInput.value.trim();
    ipcRenderer.invoke('get-users', idUsuario).then(loadUsers).catch(err => {
        console.error('Error al buscar los usuarios:', err);
    });
}).catch(err => {
    // Manejar cualquier error al obtener los usuarios
    console.error('Error al cargar los usuarios:', err);
});

I have tried doing this

// Asignar elementos del DOM a variables
const primerNombreInput = document.getElementById('primernombre');
const segundoNombreInput = document.getElementById('segundonombre');
const primerApellidoInput = document.getElementById('primerapellido');
const segundoApellidoInput = document.getElementById('segundoapellido');
const fechaNacimientoLabel = document.getElementById('fechaNacimiento');

// Actualizar los valores de los campos con los datos del usuario
primerNombreInput.value = user.Primer_Nombre;
segundoNombreInput.value = user.Segundo_Nombre;
primerApellidoInput.value = user.Primer_Apellido;
segundoApellidoInput.value = user.Segundo_Apellido;
fechaNacimientoLabel.innerText = formatFechaNacimiento(user.Fecha_Nacimiento);

but it doesnt work, the values have not the variables.