Attempting to add new DNS records to a given DNS zone results in errors similar to the following:
Error: API failure: Zone is invalid: Line XX: ignoring out-of-zone data (domain.tld) at /usr/local/cpanel/Cpanel/ZoneFile/LineEdit.pm line 390
DNS zones can only hold records for the domain the zone is for. Attempting to add records for a different domain will result in the above error. The error references the line with the issue, and gives a hint as to what the referenced domain is.
You will need to remove the record on the line given in the DNS zone. The zone will not be loaded until the record is removed.