First, I think your notation $f_i^\sharp : \mathcal{O}_Y \to {f_i}_\ast(\mathcal{O}_X)|_{U_i}$ is slightly confusing. (If I were being very careful, and I usually am when I work with sheaves, I would write $f_i^\sharp : \mathcal{O}_Y \to {f_i}_\ast(\mathcal{O}_{U_i}) = {f_i}_\ast(\mathcal{O}_X|_{U_i}).$) Anyway, we have $$s_i := f^\sharp_i(s) \in {f_i}_\ast (\mathcal{O}_{U_i})(V) = \Gamma(f_i^{-1}(V),\mathcal O_{U_i}) = \Gamma(f_i^{-1}(V),\mathcal O_{X}).$$ Thus, we consider $s_i$ as a section of $\mathcal O_X$ on $f_i^{-1}(V)\subseteq U_i.$
Set $s_{ij} = f_{ij}^\sharp(s),$ where $f_{ij} = f_i|_{U_{ij}} = f_i\circ\iota_{ij},$ with $\iota_{ij}$ the inclusion of $U_{ij}$ into $U_i.$ Since we assume that $f_{ij} = f_{ji},$ it suffices to show that $s_i|_{f_i^{-1}(V)\cap U_{ij}} = s_{ij}.$ I claim the relevant property we need is the following:
Let $f:X\to Y$ and $g:Y\to Z$ be morphisms of locally ringed spaces. Then $f^\sharp:\mathcal O_Y\to f_\ast \mathcal O_X$ induces a morphism $g_\ast f^\sharp:g_\ast\mathcal O_Y\to g_\ast (f_\ast\mathcal O_X) = (g\circ f)_\ast\mathcal O_X$ of sheaves on $Z$ satisfying $(g\circ f)^\sharp = g_\ast f^\sharp\circ g^\sharp.$
This is essentially what it means to compose two morphisms of locally ringed spaces. To see why this is true, simply consider what happens on an open neighbourhood $V\subseteq Z.$ We want to use this when $X = U_{ij},Y = U_i,Z = Y$ (somewhat confusingly), and $f = \iota_{ij},g = f_i.$
We get $s_{ij} = f_{ij}^\sharp(s) = (f_i\circ\iota_{ij})^\sharp(s) = (f_{i\ast}\iota_{ij}^\sharp\circ f_i^\sharp)(s) = f_{i\ast}\iota_{ij}^\sharp (s_i)$ which is just $s_i$ restricted to $U_{ij},$ with notational bookkeeping that reminds us we have to consider these as sheaves on $Z.$ (Note that the definition of a morphisms of sheaves applied to the inclusion $U_{ij}\subseteq U_i$ guarantees that $\iota_{ij}^\sharp(s_i)$ is the same as restricting $s_i$ to $f_i^{-1}(V)\cap U_{ij}$ as considering it as a section of $\mathcal O_{U_{ij}}$.)
First, beware, you wrote "the basic open sets of a topological space $X$". I do not know if it is just a small mistake while writing, but there can be multiple basis for a given topology. Here we just chose one, that is $B$.
Now, to define $s \in \mathcal{F}(U)$ is the same as giving compatible sections $s_V$ for each $V$ a basic open set in $U$ (compatible in the following meaning : if $V_0$ is a subset of both $V_1$ and $V_2$, where all of these $V$ are basic open sets, then $s_{V_0}$ is the restriction of both $s_{V_1}$ and $s_{V_2}$). Now, given such a $V \subset U$, if we want $s$ to satisfy the restriction conditions on $U_i$, then $s_V$ should satisfy certain conditions. Can you see what they are and how to recover $s_V$ from them ? I will leave some hints in the following spoiler that you should not read before trying by yourself.
that is, $s_V$ restricted to $V \cap U_i$ should be equal to $s_i$ restricted to $V \cap U_i$. Also, notice that you can replace the cover $V = \bigcup (V \cap U_i)$ with another cover where any open set of the cover is a basic open set (I will leave this part to you). Now you have restricted your problem to the case where all open sets are basic open, which is exactly the $B$-sheaf axiom.
In the end, all you need to show is that the $s_V$ you got this way are compatible, so that you can recover $s \in \mathcal{F}(U)$. You will also have to show unicity, but the proof is in the same vein :
$s$ is uniquely determined by the $s_V$, and the $s_V$ are unique with the restriction conditions given by the ones on $s$.
Best Answer
To answer your question, the sheaf $\mathscr{F}$ you are trying to construct can be described in the category $\mathbf{Sh}(X)$ as the limit of a certain diagram. We will consider sheaves on an open subset $U \subseteq X$ as sheaves on $X$ by the usual direct image construction.
The cocycle condition guarantees that all the triangles appearing in the diagram commute. Thus we have a well-defined diagram in $\mathbf{Sh}(X)$ and we can take its limit.
Amusingly, there is another sense in which gluing sheaves is a limit construction: the category $\mathbf{Sh}(X)$ itself is a bicategorical limit of a (pseudo)commutative diagram involving all the categories $\mathbf{Sh}(U_i)$, $\mathbf{Sh}(U_i \cap U_j)$, and $\mathbf{Sh}(U_i \cap U_j \cap U_k)$. In fancy language, we say that $\mathbf{Sh}(-)$ is a stack for the canonical topology on the site of open subsets of $X$.