I am a US national but Indian citizen. I have a question regarding US tax on sale of foreign asset. I have an apartment which was bought before I moved to USA. I am working here and paying taxes. I want to use some of it towards buying my primary home here in USA.
Since you are a US national/permanent resident you are taxed on worldwide income. Regardless of when you purchased the house, if you sell the house while you are a US resident for tax purposes, then any gain is taxable in the US.
Additionally, if the home had an existing mortgage, you may also have a currency gain/loss resulting on the repayment of the loan. A currency gain would be taxable as either ordinary income or capital gain depending on how long you held the property. A currency loss would be considered personal and non-deductible.
However, you maybe be able to exclude part or all of the gain from the sale under IRC 121 Exclusion of gain from sale of principal residence.