The attorney general sued the state, cited a law allowing New Yorkers to get a driver’s license regardless of legal status.