You are describing the so called double cosets of H and K. Denote by 1 the identity of the group G.
1. x ~ x : since 1 is in both H and K and x = 1 x 1
2. if x ~ y then for some a in H , b in K, y=axb. Then So y ~ x.
3. transitivity - use the fact that both H and K are closed under multiplication. I leave it to you.