How can I make an enemy back away from player when the player approaches?

Get the Vector from Enemy to Player : Direction = Enemy - Player.

So the position you want to Enemy to move to is : EnemyNewPosistion = Player + DistanceBetween * Direction

Only find a new Position when the distance between Player and Enemy is too close MinDistance > Direction.Size