Hello souhailabaf,
Being able to sign in to the App Store and iTunes Store is important, and Apple Support Communities is a fantastic place for help! To confirm, are you able to sign in to your Apple ID for other features such as iMessage, FaceTime, or visit the Apple ID website linked below and sign in? The reason this information is important, is to help isolate the issue further and determine the appropriate troubleshooting steps. If you have issues signing in to other Apple ID features or the Apple ID website, please share any error messages you're seeing.
Manage your Apple ID
If so, try the steps outlined below, of which can also be found in the following article.
If you can't connect to the App Store, iTunes Store, or other Apple services
"Check the system status page: Check Apple’s System Status page to see if there’s an outage for a service in your country or region.Make sure that your device is connected to the internet: Use any web browser to connect to any website. If nothing loads, use another device on the same network to see if it can connect to any website. If no other devices can access the internet, turn off your Wi-Fi router, then turn it on again to reset it. If you still can’t connect to your Wi-Fi network, contact your internet provider for more help. If only your first device can’t connect to the internet, get help with Wi-Fi on your iPhone, iPad, or iPod touch, Apple Watch, Apple TV, or Mac. If you use cellular service to connect to the internet on your iPhone or iPad, make sure that you have cellular data turned on for the app that you're using. To do this, open the Settings app, tap Cellular, then turn on Cellular Data.Update your software: Update to the latest version of iOS or iPadOS, macOS, tvOS, watchOS, or software for your non-Apple device. Then try to connect again.Check the date and time: Make sure that the date and time on your device are set correctly for your time zone. On your Mac: Open System Preferences, then choose Date & Time."
"If the date and time are incorrect, update them or turn on the option to set date and time automatically."
While the title of the article references different issues, these are the right troubleshooting steps to help resolve the issue you're facing. If you continue to have issues after those steps, you'll want to reach out to Apple for additional support. Their contact details can be found via the Get Support website.
Take care!