Preliminary
The main result of the Fama-MacBeth procedure is to calculate standard errors that correct for cross-sectional correlation in a panel. It is a commonly used method due to it's easily approach, and with regards to the time it was developed (1973), modern techniques like clustered robust standard errors were not yet invented. In this context, it was a convenient technique that allowed changing betas over time, which a single unconditional cross-sectional regression or a time-series regression test cannot easily handle.
Fama-MacBeth regression
In the original application of their 1973-paper, Fama-MacBeth run the following cross-sectional regression at each period of time:
$$R_{t}^{ei}= \beta_{i}^{'}\lambda_t+a_{it}$$
where $R_{t}^{ei}$ is the excess-return of asset $i$ at time $t$ and $\beta_{i}^{'}$ denotes the estimated beta-factor of the stock. The first step you described is the time-series estimation of $\beta_{i}^{'}$. What follows is the estimation of beta's risk-premium, i.e. the slope $\lambda_t$ (see this excellent answer for more details).
They suggest that we can estimate $\lambda$ and $a_{it}$ as the average of the cross-sectional regression estimates,
$$\hat{\lambda} = \frac{1}{T} \sum_{t=1}^{T}{\hat{\lambda}}_t$$
$$\hat{a}_i = \frac{1}{T} \sum_{t=1}^{T}{\hat{a}}_{it}$$
but most importantly, they suggest that we use the standard deviations of the cross-sectional regression estimates to generate the sampling errors for these estimates,
$$\sigma^2(\hat{\lambda}) = \frac{1}{T^2} \sum_{t=1}^{T}{\left( \hat{\lambda}_t - \hat{\lambda} \right)^2}$$
$$\sigma^2(\hat{a}_i) = \frac{1}{T^2} \sum_{t=1}^{T}{\left( \hat{a}_{it} - \hat{a}_i \right)^2} $$
Cochrane (2005) states:
Sampling error is about how a statistic would vary from one sample to the next if we repeated the observations. We cannot do that with only one sample, but why not cut the sample in half [..]. The Fama-MacBeth procedure carries this idea to its logical conclusion, using the variation in the statistic $\hat{\lambda}_t$ over time to deduce its variation across samples.
Your approach
You mention
Each firm has its own market cap in June, its own book-to-market ratio etc.
,which is right, just as each stock has it's own estimate for $\hat{\beta}_i$.
Besides the variable for the momentum of a stock (which is updated each month), each variable is measured at the end of June in year $t$. Then, you have to run the above regression (in a multivariate way!), where $\beta_{i}^{'}$ is replaced by the single variables market-capitalization,..., for July of year $t$ up to end of June in $t+1$. In fact, for these regression, only the left hand sight variable of a stocks (monthly) excess-return is updated.
To be clear: You match the monthly stock return with variables measured at the end of the previous month (e.g the monthly return of July with market-cap, etc. at the end of June).
In June of $t+1$, you update your right-hand variables and go on for the whole period of time, which finally gives you the whole monthly time-series for slopes of each variable.
References:
Cochrane (2005), Asset Pricing, rev. edition, chap. 12.3.