If you fail to perform as a buyer for any reason you can loose your deposit
Did you stipulate in your purchase agreement that the purchase was contingent on you selling your home?
As for a tax deduction, I do not think you will be able to deduct the lost deposit.
Double check with a tax professional to make sure.
I hope all works out for you, sounds like this is a tough situation to be in. Maybe your home is priced too high. Maybe a price adjustment or some buyer incentives may boost the chance of you getting it sold.
Best of luck to you!
Kawain Payne, Realtor