How to make enemy shoot at the player?

Hello everybody I want to make a game in which the enemies follow the player and shoot at him. They can follow the player and I can manage to make them shoot, but I don’t know what to do to make them shoot exactly at the player.What code should I write (its a 3 D game) Please help me out since I am still a beginner.

It depends a bit on whether you are using hitscan based weapons (raycast) or projectile based weapons. And also on whether or not the enemies (and their weapons) are already facing in the direction of the player.

Either way, you will need the vector pointing from your enemy to the player:

Vector3 dirToPlayer = (player.transform.position - enemy.transform.position);

Depending on your setup you then either rotate the weapon of the enemy in that direction and shoot the bullet in the forward direction of the weapon, or you simply make the ray / bullet travel in that direction.
For projectile based weapons you will have to calculate a position in the movement direction of the player, based on the player velocity and the bullet velocity, such that they both meet at that position.