As of 8 December 2021

The requirements have changed again, in reaction to the Omicron variant of the Covid-19 virus.
Summary :
US – UK requires negative test result in the 2 days before departure. UK – US requires a negative test result in 1 day before departure.
https://www.gov.scot/publications/coronavirus-covid-19-international-travel-quarantine/pages/red-amber-and-green-list-countries/ is the starting point. The US is a ‘non redlist country’ from the point of view of the UK.
Assuming you have been fully vaccinated, you need the US CDC card, and proof of your US address. You need to take a COVID-19 PCR or lateral flow test up to 2 days before you depart for Scotland. You’ll need to provide proof that the result of this test was negative to be able to board your flight.
If you’re changing flights on your way to Scotland, you’ll need to take your COVID-19 test in the 2 days before you board your first flight.
In advance, you should book and pay for the required Covid-19 test that is sent by post to the address in Scotland where you are going to be staying; that booking produces a reference number for the Passenger Locator Form (PLF) . You can use the CTM booking portal to book and pay £68 for an NHS COVID-19 PCR test, or you can buy a Day 2 PCR or Day 2 lateral flow test from a list of private providers.
Within 48 hours before arrival in the UK you need to complete a PLF. This includes the flight number and arrival time, and won’t let you finish the form until 48 hours before.
The UK form applies for entry to Scotland https://www.gov.uk/provide-journey-contact-details-before-travel-uk . I printed the PLF – the airline checks it, and it is checked again at the UK border.You need to take the test you booked within 2 days of arriving in Scotland.
To return to the US from Scotland, you have to take a test before you leave the UK.
https://www.cdc.gov/coronavirus/2019-ncov/travelers/testing-international-air-travelers.html has the requirements. You will need to get a COVID-19 viral test (regardless of vaccination status) before you travel by air into the United States. You must show your negative result to the airline before you board your flight.
If you are fully vaccinated, you need to take a viral test no more than 1 day before the flight’s departure from a foreign country. This doesn’t have to be a PCR test. An antigen test, although not a self administered test, is sufficient. Newington Pharmacy in Edinburgh had a turn round time of 15 minutes, given an advance booking, for giving me the printed result. A picture of that result, uploaded to the airline check in process, meant I could get a printed boarding pass, and so change terminals airside in Heathrow.