Only direct free kick offences committed by a team in their own penalty area result in a penalty kick.
For indirect free kick offences that are committed by a defending team inside their own goal area, the position of the free kick is the closest point to the infringement on the goal area line parallel to the goal line - or in simpler terms, the ball is moved directly back towards the attacking team's goal line until it's on the longest line of the goal area.
As for the first part, the offence occurs when the ball is handled by the goalkeeper after having been deliberately kicked to the goalkeeper by a teammate. In your example, this still holds true, as after the ball was kicked to the goalkeeper by a teammate, it wasn't either:
- played by an opponent; or
- played by a teammate in a way that wasn't a deliberate kick to the goalkeeper.
The correct decision here is an indirect free kick to the opponents. This is also the case if the goalkeeper receives the ball outside the penalty area with his feet, dribbles it back into the penalty area, and handles it.