Can someone please explain to me the fg rules. Like when it comes out to the 20 and when the ball is spot from where it was kicked.
The suggestion to read the Rule Book is always a good one. And I think you question is further confusing because the ball is never spotted from where it is kicked -- that is an NFL rule.
So, really the question you are trying to answer is what is the Succeeding Spot (the spot where the ball will next be put into play) on a missed FG. The general answer is, (a) if the ball was snapped from outside the 20 yard line, the Succeeding Spot is the Previous Spot [so, ball is snapped from the 32 and kicked wide right, then Team B takes over at the 32 yard line {and not the 39 yard line where the ball might have been kicked from}]; (b) if the ball was snapped from inside the 20 yard line, the Succeeding Spot is the 20 yard line [so, ball is snapped from the 14 and kicked wide right, then Team B takes over at the 20].
Now, this is the general rules to apply to your simple question. This is only part of the story. All kinds of different answers is the ball is blocked, or touched, or lands short of the end zone, or is caught by Team B and returned, etc. etc. etc.