Constructing a function over a metric space through given points
Applying rescaling you can assume that $L=1$.
We look for a 1-Lipschitz piecewise linear maps $f\colon\mathbb{R}^m\to\mathbb{R}^n$.
If $m=n$ we get $f$ from Brehm's theorem; it says that there is a piecewise distance preserving map of that type (in particular 1-Lipschitz and piecewise linear). See Brehm, U., Extensions of distance reducing mappings to piecewise congruent mappings on $\mathbb{R}^m$ and also our paper written for kids.
If $m<n$ we can think that $\mathbb{R}^m$ is a subspace of $\mathbb{R}^n$; in this case apply Brehm's theorem and restrict the obtained map to $\mathbb{R}^m$.
If $m>n$ we can think that $\mathbb{R}^n$ is a subspace of $\mathbb{R}^m$; in this case apply Brehm's theorem and compose the obtained map with the projection to $\mathbb{R}^n$. Since projection linear and 1-Lipschitz, so it the composition.
Anton's answer is for the case where $X$ is a subset of a Hilbert space. For $X$ a general metric space (compactness does not help, BTW), $L$ must be increased by a factor of order $\log^{1/2}N$; see $$$$ Johnson, William B.; Lindenstrauss, Joram Extensions of Lipschitz mappings into a Hilbert space. Conference in modern analysis and probability (New Haven, Conn., 1982), 189–206, Contemp. Math., 26, Amer. Math. Soc., Providence, RI, 1984.