Does Xcode save your answer to the system when agreeing to the License Agreement?
When you agree to the Xcode license, an entry is created in:

/Library/Preferences/com.apple.dt.Xcode.plist


As shown in the image below:



Or from Terminal using the defaults command:

$ defaults read /Library/Preferences/com.apple.dt.Xcode.plist 
{
    IDELastGMLicenseAgreedTo = EA1478;
    IDEXcodeVersionForAgreedToGMLicense = "9.4.1";
}
$