How to calculate position where bullet should be spawned

I have a 2d game where player can shoot bullets in a direction of their mouse. Everything works quite fine, but the problem is with bullet spawning. I am creating them on position where player, which is in center of player prefab. That means the bullet appears in a middle of player and then continues in a direction, which is almost what I want.

I would prefer if the bullet was spawned on edge of a player collision though, however I have no idea how to accomplish that, neither how to calculate this.

I know the position of player (X, Y) and I know a position of a mouse (X, Y). I need to calculate where the edge of player in direction from player to mouse is and spawn a bullet there. How would I do that?

For a beginning I would be fine just to know how to get a point X that is N points in distance from point A in direction from A to B.

Create an empty game object (lets call it muzzle) as a child of your player. Set the position of this muzzle game object on the player from where you want to shoot the bullets.

Now in your script rather than shooting from the position of bullet, shoot from the position of the muzzle game object.