Lol To be fair, you're pretty much asking others to make the whole game for you
It's not just about the snake growing or the fruit changing position, but also:
1. the keypresses aren't properly read
2. there's nothing in place to make the snake move
3. there's this addsnake class / struct in your code but it doesn't exist.
Not flaming you at all, but it seems you're trying to fly when you have to learn to walk first.
Here are some tips based on how i would make a first snake game:
1. Don't use 4 black sf::rectangleShapes to make a border. just clear the window using black color and then use a single sf::rectangleShape to draw the cyan playField.
2. Since the snake and the fruit are 20x20 squares, don't think of the playfield as a 400x400 square, but instead as a grid of 20x20 positions.
3. Use a separate function createFruit() which randomly determines a new location for the fruit to be created. Pass the snake vector array to this function so that the function can check whether the new fruit is sharing a spot with a snake tailpiece - if so, find a new spot. The function then returns the randomly generated grid position x and y of the fruit which you keep in a variable.
4. Use a vector array to keep track of each bodypart of the snake. Whenever the snake moves, loop through the vector to determine the new position of each tailpiece based on the previous tailpiece.
5. Add an sf::clock to the game and check for the elapsed time. Use a speed variable and determine at which elapsed time amount you want to update the snake's position (thus determining the game speed)
6. When the snake moves, make several checks on the first vector array record (the head).
- if its grid position equals that of the fruit, call the createFruit() function (and increase a score variable by 1)
- if its grid position equals that of a tailpiece, it's game over
- if its grid position is lower or higher than the amount of available grid positions, it's game over
Don't try to build Snake in 1 go. Read some SFML documentation on events, sf::Clock, vectors, etc. Just focus on parts of the game and get those to work first (keyboard input, snake head movement). Then when you figured each part out, combine them and you build your very own game.
Good luck!