Here is the piece of command for accepting license
yes | "$ANDROID_SDK_ROOT"/cmdline-tools/bin/sdkmanager --sdk_root=/tmp/android-sdk-linux --licenses
even after this still I see the license errors
Reference : Failed to install the following Android SDK packages some licences have not been accepted