Once you've upserted your service contract, Apex puts the database ID in your object in memory. Once that is done you can use that to populate the value in your line items and insert them too.
Knowing this it may make more sense to first to the service contract upsert, and only then generate your line items.
try
{
upsert(sc);
contractItems = new List<ContractLineItem>();
for (OpportunityLineItem items : lineItems)
{
ContractLineItem cli = new ContractLineItem();
cli.Discount = items.Discount;
cli.Description = items.Description;
cli.PricebookEntryId = items.PricebookEntryId;
cli.Quantity = items.Quantity;
cli.UnitPrice = items.UnitPrice;
cli.ContractId = sc.id; //this wll now be filled
contractItems.add(cli);
}
}catch(....etc