Yes, you can. You can use some or all of your Lifetime ISA to buy your first home, and continue paying into it until just before your 50th birthday. When you turn 60, you can withdraw money from your LISA penalty-free to fund your retirement.
Keep in mind you can use a Lifetime ISA to buy your first home only if it’s worth £450,000 or less and you‘re buying with a mortgage. And if you save in a LISA rather than enrolling in a qualifying scheme, occupational pension scheme or personal pension scheme, you may lose the benefit of contributions by an employer (if any) and your future entitlement to means-tested benefits may be affected.