Hello Giuseppe,
The issue you're encountering is known as overfitting in machine learning. Essentially, by using all available data for training the networks, the model may fit the data very well, possibly too well. Consequently, when testing the model with the same data it was trained on, it will likely perform well because it's already familiar with that data. However, when presented with new data, the model's performance will likely be worse than before because instead of learning general patterns, it has simply memorized the dataset, resulting in overfitting. That is why it is recommended to have 3 sets of dataset training, validation, and testing.
Please go through this documentation to know the importance of these 3 datasets,
Hope this helps.