Thank you!
When I made this game I was a beginner in code. I used a very simple pathfinding algorithm. Flood fill algorithm. I think it's not the best solution, but for my level at this time, it was relatively easy to code.
For the movement of the unit you mark the destination tile by a 0, and from it you add +1 in the 4 adjacency tiles, and repeat the operation for each next tiles. You have to ignore the tile which has already a number.
Then your unit just needs to choose in his 4 adjacency tiles the tile with the smallest number and go to it. And repeat the operation until it reaches the destination tile.
For the green zone where you can see the possible destinations of the unit, I use the same method.
If the unit has a movement of 4. From the unit position (0) I add +1 to the adjacency tiles etc. I draw a green square on each tiles and ignore the tiles with another unit or obstacle. When I reach 5, I stop the algorithm so I can see the green zone.
Then I can choose a tile in this zone.
When I click on a green tile, this tile become the destination tile with a 0, and I repeat the algorithm until it reaches the selected unit. Then the unit has just to go to the destination like I said before.
It's not the best solution but it worked for my little game, if I had to create a new one now, I probably use another method.