Endomorphisms of measured equivalence relations, cocycles with values in non-locally compact groups and applications