Easy option
There is a Margin around features function in the atlas settings that you could use.
Solution based on Geometry generator
If you indeed want to use the extent of a layer resulting by geometry expression, proceed as follows:
In the layer containing the lines, create a virtual field using field calculator to create a field named xmin
with this expression: x_min (bounds ( [your_geometry_expression] ))
Be sure to replace [your_geometry_expression]
with the expression that creates the extended lines.
If you create virtual fields, you can add, delete, modify the lines and still get correct results.
Repeat step 1 for xmax, ymin and ymax.
Go to the Layour manager -> Item Properties of the map/atlas -> Extents and use the fields created in steps 1 and 2 as input for data driven override.
Screenshot
Extents -> Data driven override (ɛ
icon) in red box; below, highlighted in yellow: setting for Margin around feature
(here set to 0). As you see, the extent from the extended line (red) is used, not the extent of the initial line (black):