The verb particle '了' after '去' in "去了厕所两次" indicates the verb '去' is completed, so "去了(went to) 厕所两次 (the bathroom twice)" is the correct translation
The final particle '了' after '去厕所两次' emphasizes 两次 --> "两次了" = "twice already"
But '了' here can also function as a verb particle that indicates the verb phrase 去厕所两次 as a completed action --> "[去]厕所两次[了]" = "[went to] the bathroom twice"
Both translations are valid, but the first one is more literal (word for word translation)