K-1 and Form 8949 re tax basis

In 2021 I purchased shares in a Partnership

I sold all my shares in 2023, April due to the complicated nature in filing taxes on the shares

I am trying to calculate the basis:

the Capital Acct. Analysis = K-1 Part II, Line L shows

2021 = Beginning capital acct $ X

              Current year net income = + $ Y --> this number is listed on K-1 Line 19 "A"

              Withdrawals and distributions - $ Y

               Ending capital acct = $ X     --> X + Y - Y = X

2022 same as 2021

2023 year of sale =

Begin = $ X - same as 2021

Current year income = + 2023 $ Y       Line 19A

Withdrawals and distributions = 2021 $X + 2023 $ Y

End = $0

 

Is my basis the original 2021 Begin Capital Acct $X ??

or 

do I add 2021 + 2022 + 2023 Line 19A / Part II Line L Current Year income

to the basis

 

Many thanks for your help !

 

Tom

 

P.S. Each year the K-1 Part III Line 20 was blank, i.e. no codes

and the Part III Line 4B+C  = Part III Line 20 = Part II Line L current year income