Let’s consider the z-score calculation of data $x_i$ with mean $\bar{x}$ and standard deviation $s_x$.
$$z_i = \dfrac{x_i-\bar{x}}{s_x}$$
This means that, given some data $(x_i)$, we can transform to data with a mean of $0$ and standard deviation of $1$.
Rearranging, we get:
$$x_i = z_i s_x+ \bar{x}$$
This gives us back our original data with the original mean $\bar{x}$ and standard deviation $s_x$. But we could’ve gone to data $y_i$ with any mean $\bar{y}$ and standard deviation $s_y$.
$$y_i = z_i s_y +\bar{y}$$
Now combine the two transformations, first to $z_i$ and then to $y_i$.
$$y_i = \dfrac{x_i-\bar{x}}{s_x}s_y + \bar{y}$$
This is the same as what Henry posted, but I do think it is helpful to see that we get there by first going to standardized data and then transforming to data with the mean and standard deviation values we desire.