Coding problem

Further to your help, I was tried to do something like this.
First of all, thank you for your detailed answers and your patience, I learn a lot from this. :slightly_smiling_face:
I have this problem that my output is duplicated to many times instead to print one time
HERE
I know this is not like you told me, I will fix it at the end, according to your explanations.
In my code I have few facts and then I want to check if x_lt_y
for all y
If is true, I want to print an HERE and then stop with fail (Because I want that my program will continue to another check rule)
The first use of findall found all the facts that x_lt_y(a, X).
The second use of findall found all the facts that some_fact_s of specific name value is bigger then a value.
Hopefully you can help me understand why it’s return back and print the same.
(I tried to debug but I didn’t understand)

Code:

x_lt_y(a, b).
x_lt_y(a, c).


some_fact_s(b, 5).			% (name, start_value)
some_fact_s(c, 6).			% (name, start_value)
some_fact_s(a, 1).			% (name, start_value)
some_fact_e(a, 2).			% (name, end_value)


is_not_empty(List) :- 																	
	member(_,List).

check(A, _a_end) :- 
	findall(B, x_lt_y(A, B), Result),
	format("~k~n", [Result]),
	is_not_empty(Result),
	findall(X, (member(X, Result), some_fact_s(X, _b_start), _b_start > _a_end), Result2),
	is_not_empty(Result2),
	format("[HERE]~n", []),
	fail.


check(A, _a_start) :- 
.
.
.
.

Output:

?- check(a, 2).
[b,c]
[HERE]
[HERE]
[HERE]
[HERE]
false.