On variation of eigenvalues of birth and death matrices and random walk matrices