1+1

K=PD[Xp[3,1,4,6],Xp[1,5,2,4],Xp[5,3,6,2]]

K

t1=K/.{Xp[i_,j_,k_,l_]:>A p[i,j]p[k,l]+(A^(-1))p[i,l]p[j,k]}

Times@@t1

t2=Expand[Times@@t1]

t3=t2 //. {p[i_,j_]p[j_,k_]:>p[i,k]}

t4=t3/.{p[i_,i_]->(-(A^2)-(A^(-2))), ((p[i_,j_])^2)->(-A^2-(A^(-2)))}

Expand[t4]