I do not have the Estimates Starter Solution open as I make this response. The names I use are thus likely to be different and you'll need to compare what I am suggesting to what you actually have in that file and change names as needed.
Basic relationships for this are:
Estimates::__pkEstimateID = LineItems::_fkEstimateID
Products::__pkProductID = LineItems::_fkProductID
This script will take a Product ID passed to it as a script parameter and use it to create a new record in LineItems that is linked to the curreent Esimates records so that it automatically appears in your portal to LineItems when you click that button.
Set Variable [$EstID ; value: Estimates::__pkEstimateID ]
Go to Layout ["LineItems" ( LineItems ) ]
Set Field [LineItems::_fkProductID ; Get ( ScriptParameter ) ]
Set Field [LineITems::_fkEstimateID ; $EstID ]
Go to Layout [Original Layout]
In button setup, when you set up the button to perform the above script, you'll find a box labeled "Optional script parameter". Put the product ID of the desired product in that box in order for the above script to work.
For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained